コード例 #1
0
#!/usr/bin/env python

from __future__ import print_function

import pyslurm

TrigID = 5
a = pyslurm.trigger()

try:
    a.clear(TrigID)
except ValueError as e:
    print("Unable to clear trigger : {0}".format(e.args[0]))
else:
    print("TriggerID ({0}) cleared".format(TrigID))

コード例 #2
0
ファイル: triggers_list.py プロジェクト: fasrc/pyslurm
#!/usr/bin/env python

from __future__ import print_function

import pyslurm

try:
    a = pyslurm.trigger()
    trig_dict = a.get()
except ValueError as e:
        print("Trigger error - {0}".format(e.args[0]))
else:
    if len(trig_dict) > 0:

        print('{0:*^80}'.format(''))
        for key, value in trig_dict.iteritems():
            print("Trigger ID                : {0}".format(key))
            for part_key in sorted(value.iterkeys()):

                if 'res_type' in part_key:
                    print("{0:<25} : {1}".format(part_key, pyslurm.get_trigger_res_type(value[part_key])))
                elif 'trig_type' in part_key:
                    print("{0:<25} : {1}".format(part_key, pyslurm.get_trigger_type(value[part_key])))
                else:
                    print("{0:<25} : {1}".format(part_key, value[part_key]))
            print('{0:*^80}'.format(''))
    else:
        print("No triggers found !")