source: trunk/examples/logpbs.py @ 356

Last change on this file since 356 was 356, checked in by martijk, 6 years ago

python3 compatible print #26732

  • Property svn:keywords set to Id
File size: 863 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 356 2018-04-11 11:57:42Z martijk $
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.