Set 'max_run_subjobs' job array property in a queuejob hook

I am trying to set the a max_run_subjobs job array property for a queuejob hook .

According to the documentation manual:

You can set a limit on the number of simultaneously running subjobs from any one array job by setting the job’s max_run_subjobs attribute, either via qalter -Wmax_run_subjobs=<new value> <job ID>, or in a queuejob or modifyjob hook.

However , the manual on hooks makes no reference to this field.

I would expect to be able to set this property like:
pbs.event().job.max_run_subjobs = n

So how am I able to set max_run_subjobs for a job array during an event hook ?

These two array attributes are readable/settable in a queuejob hook (for example):

qsub -l select=1 -J 1-10%5 …/job.script

pbs.logmsg(pbs.LOG_DEBUG, “array_indices_submitted value = {}”.format(j.array_indices_submitted))
pbs.logmsg(pbs.LOG_DEBUG, “max_run_subjobs value = {}”.format(j.max_run_subjobs))

11/17/2021 20:08:45;0006;Server@trn-smgoo;Hook;Server@trn-smgoo;array_indices_submitted value = 1-10
11/17/2021 20:08:45;0006;Server@trn-smgoo;Hook;Server@trn-smgoo;max_run_subjobs value = 5

You should be able to set max_run_subjobs in a queuejob hook as you would any other job attribute.

@smgoosen I am seeing something different.

I am submitting the following job:

qsub -l select=1 -J 1-2

And looking at job properties:

AttributeError: '_job' object has no attribute 'max_run_subjobs'

Also inspecting the job properties, I get the following list:

['_readonly', '_rerun', '_delete', '_checkpointed', '_msmom', '_stdout_file', '_s
tderr_file', '__module__', 'attributes', '_attributes_hook_set', '__new__', '__init__', '__str__', '__setattr__', 'rerun', 'delete', 'is_checkpointed', 'in_ms_mom', '
stdout_file', 'stderr_file', 'release_nodes', '__dict__', '__weakref__', '__doc__', 'id', 'failed_mom_list', 'succeeded_mom_list', '_connect_server', 'Job_Name', 'Job
_Owner', 'resources_used', 'resources_used_acct', 'resources_used_update', 'job_state', 'queue', 'server', 'Account_Name', 'Checkpoint', 'ctime', 'depend', 'Error_Pat
h', 'exec_host', 'exec_host2', 'exec_host_acct', 'exec_host_orig', 'exec_vnode', 'exec_vnode_acct', 'exec_vnode_deallocated', 'exec_vnode_orig', 'Execution_Time', 'gr
oup_list', 'Hold_Types', 'interactive', 'Join_Path', 'Keep_Files', 'Mail_Points', 'Mail_Users', 'mtime', 'no_stdio_sockets', 'Output_Path', 'Priority', 'qtime', 'Remo
ve_Files', 'Rerunable', 'Resource_List', 'Resource_List_orig', 'Resource_List_acct', 'schedselect', 'schedselect_orig', 'stime', 'session_id', 'Shell_Path_List', 'san
dbox', 'jobdir', 'stagein', 'stageout', 'substate', 'User_List', 'Variable_List', 'euser', 'egroup', 'hashname', 'hop_count', 'queue_rank', 'queue_type', 'sched_hint'
, 'security', 'comment', 'cookie', 'alt_id', 'alt_id2', 'etime', 'reserve_start', 'reserve_end', 'reserve_duration', 'reserve_state', 'reserve_Tag', 'reserve_ID', 'la
st_context_refresh', 'gridname', 'umask', 'block', 'cred', 'run_count', 'accounting_id', 'eligible_time', 'accrue_type', 'sample_starttime', 'job_kill_delay', 'Stageo
ut_status', 'Exit_status', 'Submit_arguments', 'executable', 'argument_list', 'prov_vnode', 'array', 'array_id', 'array_index', 'array_state_count', 'array_indices_su
bmitted', 'array_indices_remaining', 'pset', 'estimated', 'node_set', 'history_timestamp', 'project', 'forward_x11_cookie', 'forward_x11_port', 'ptime', 'run_version'
, 'gui', 'topjob_ineligible', 'resources_released', 'resource_released_list', 'release_nodes_on_stageout', 'tolerate_node_failures', 'Submit_Host', 'credential_id', '
credential_validity', 'create_resv_from_job', '_other_', '__repr__', '__hash__', '__getattribute__', '__delattr__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__',
'__ge__', '__reduce_ex__', '__reduce__', '__subclasshook__', '__init_subclass__', '__format__', '__sizeof__', '__dir__', '__class__']

The property max_run_subjobs is not part of that list. So how are you able to access that attribute?

What version of PBS Pro are you running? max_run_subjobs was introduced in 2020.1 so if you’re using a version older than that it will not be available.

@smgoosen so I am using OpenPBS v20.0.1 , which is the latest stable release.

OK, that’s the issue, that OpenPBS release did not have this feature merged yet when it was created. If you were to build from the current master it would have max_run_subjobs.

@smgoosen thanks ! I think I am using the stable released version so that would explain it.