source: trunk/examples/logpbs.py @ 329

Last change on this file since 329 was 110, checked in by bas, 18 years ago

distro:

  • New release 2.9.0
  • New build system for torque 2.1.0 and higher
  • Property svn:keywords set to Id
File size: 861 bytes
Line 
1#!/usr/bin/env python
2#
3# Author: Bas van der Vlies <basv@sara.nl>
4# Date  : 21 Oct 2002
5# Desc. : How to use the logging facility of Openpbs
6#
7# $Id: logpbs.py 110 2006-04-20 12:28:20Z bas $
8#
9import pbs
10import sys
11
12def main():
13 
14   # Open log in current directory with current date
15   #
16   if pbs.log_open('', '.'):
17     print 'Could not open log file'
18     sys.exit(1)
19
20   pbs.log_record(pbs.PBSEVENT_ERROR, pbs.PBS_EVENTCLASS_REQUEST, 'test1', 'this a test message')
21
22   # Give a verbose message of closing the file
23   #
24   pbs.log_close(1)
25
26   # Open the sched log file
27   #
28   if pbs.log_open('', '/var/spool/torque/sched_logs'):
29     print 'Could not open log file in /var/spool/torque/sched_logs'
30     sys.exit(1)
31
32   pbs.log_record(pbs.PBSEVENT_JOB, pbs.PBS_EVENTCLASS_JOB, 'test1', 'this a test message')
33
34   # Give a NON verbose message of closing the file
35   #
36   pbs.log_close(0)
37
38main()
Note: See TracBrowser for help on using the repository browser.