pipen.pluginmgr
Define hooks specifications and provide plugin manager
PipenMainPlugin
— The builtin core plugin, used to update the progress bar andcache the job </>XqutePipenPlugin
— The plugin for xqute working as proxy for pipen plugin hooks</>
clear_path
(
job
,path
,is_dir
)
(bool) — Clear the path, either a file or a directory</>get_mtime
(
job
,path
,dirsig
)
(float) — Get the mtime of a path, either a file or a directory</>norm_inpath
(
job
,inpath
,is_dir
)
(str) — Normalize the input path</>norm_outpath
(
job
,outpath
,is_dir
)
(str) — Normalize the output path</>on_complete
(
pipen
,succeeded
)
— The the pipeline is completed.</>on_init
(
pipen
)
— When the pipeline is initialized, and default configs are loaded</>on_job_cached
(
job
)
— When a job is cached.</>on_job_failed
(
job
)
— When a job is done but failed.</>on_job_init
(
job
)
— When a job is initialized</>on_job_killed
(
job
)
— When a job is killed</>on_job_killing
(
job
)
(bool) — When a job is being killed.</>on_job_polling
(
job
)
— When status of a job is being polled.</>on_job_queued
(
job
)
— When a job is queued in xqute. Note it might not be queued yet inthe scheduler system. </>on_job_started
(
job
)
— When a job starts to run in then scheduler system.</>on_job_submitted
(
job
)
— When a job is submitted in the scheduler system.</>on_job_submitting
(
job
)
(bool) — When a job is submitting.</>on_job_succeeded
(
job
)
— When a job completes successfully.</>on_jobcmd_end
(
job
)
(str) — When the job command finishes and after the postscript is run</>on_jobcmd_init
(
job
)
(str) — When the job command wrapper script is initialized before the prescript is run</>on_jobcmd_prep
(
job
)
(str) — When the job command right about to be run</>on_proc_create
(
proc
)
— Called Proc constructor when a process is created.</>on_proc_done
(
proc
,succeeded
)
— When a process is done</>on_proc_init
(
proc
)
— Called when a process is initialized.</>on_proc_input_computed
(
proc
)
— Called after process input data is computed.</>on_proc_script_computed
(
proc
)
— Called after process script is computed.</>on_proc_shutdown
(
proc
,sig
)
— When pipeline is shutting down, by Ctrl-c for example.</>on_proc_start
(
proc
)
— When a process is starting</>on_setup
(
config
)
— Setup for plugins, primarily used for the plugins tosetup some default configurations. </>on_start
(
pipen
)
— Right before the pipeline starts running.</>output_exists
(
job
,path
,is_dir
)
(bool) — Check if the output exists</>
pipen.pluginmgr.
on_setup
(
config
)
Setup for plugins, primarily used for the plugins tosetup some default configurations.
This is only called once for all pipelines.
config
(Dict) — The configuration dictionaryplugin options should be defined under "plugin_opts" One should define a configuration item either with a prefix as the identity for the plugin or a namespace inside the plugin config
pipen.pluginmgr.
on_init
(
pipen
)
When the pipeline is initialized, and default configs are loaded
pipen
(Pipen) — The Pipen object
pipen.pluginmgr.
on_start
(
pipen
)
Right before the pipeline starts running.
Process relationships are inferred.
pipen
(Pipen) — The Pipen object
pipen.pluginmgr.
on_complete
(
pipen
, succeeded
)
The the pipeline is completed.
pipen
(Pipen) — The Pipen objectsucceeded
(bool) — Whether the pipeline has successfully completed.
pipen.pluginmgr.
on_proc_create
(
proc
)
Called Proc constructor when a process is created.
Enables plugins to modify the default attributes of processes
proc
(Proc) — The Proc object
pipen.pluginmgr.
on_proc_init
(
proc
)
Called when a process is initialized.
Allows plugins to modify the process attributes after initialization, but before the jobs are initialized.
proc
(Proc) — The Proc object
pipen.pluginmgr.
on_proc_input_computed
(
proc
)
Called after process input data is computed.
proc
(Proc) — The Proc object
pipen.pluginmgr.
on_proc_script_computed
(
proc
)
Called after process script is computed.
The script is computed as a string that is about to compiled into a template.
proc
(Proc) — The Proc object
pipen.pluginmgr.
on_proc_start
(
proc
)
When a process is starting
proc
(Proc) — The process
pipen.pluginmgr.
on_proc_shutdown
(
proc
, sig
)
When pipeline is shutting down, by Ctrl-c for example.
Return False to stop shutting down, but you have to shut it down
by yourself, for example, proc.xqute.task.cancel()
Only the first return value will be used.
sig
(signal.Signals) — The signal.None
means a natural shutdownpipen
— The xqute object
pipen.pluginmgr.
on_proc_done
(
proc
, succeeded
)
When a process is done
proc
(Proc) — The processsucceeded
(bool | str) — Whether the process succeeded or not. 'cached' if all jobsare cached.
pipen.pluginmgr.
on_job_init
(
job
)
When a job is initialized
job
(Job) — The job
pipen.pluginmgr.
on_job_queued
(
job
)
When a job is queued in xqute. Note it might not be queued yet inthe scheduler system.
job
(Job) — The job
pipen.pluginmgr.
on_job_submitting
(
job
)
When a job is submitting.
The first plugin (based on priority) have this hook return False will cancel the submission
job
(Job) — The job
False to cancel submission
pipen.pluginmgr.
on_job_submitted
(
job
)
When a job is submitted in the scheduler system.
job
(Job) — The job
pipen.pluginmgr.
on_job_started
(
job
)
When a job starts to run in then scheduler system.
Note that the job might not be running yet in the scheduler system.
job
(Job) — The job
pipen.pluginmgr.
on_job_polling
(
job
)
When status of a job is being polled.
job
(Job) — The job
pipen.pluginmgr.
on_job_killing
(
job
)
When a job is being killed.
The first plugin (based on priority) have this hook return False will cancel the killing
job
(Job) — The job
False to cancel killing
pipen.pluginmgr.
on_job_killed
(
job
)
When a job is killed
job
(Job) — The job
pipen.pluginmgr.
on_job_succeeded
(
job
)
When a job completes successfully.
job
(Job) — The job
pipen.pluginmgr.
on_job_cached
(
job
)
When a job is cached.
job
(Job) — The job
pipen.pluginmgr.
on_job_failed
(
job
)
When a job is done but failed.
job
(Job) — The job
pipen.pluginmgr.
norm_inpath
(
job
, inpath
, is_dir
)
Normalize the input path
job
(Job) — The jobinpath
(str | os.pathlike) — The input pathis_dir
(bool) — Whether the path is a directory
The normalized path
pipen.pluginmgr.
norm_outpath
(
job
, outpath
, is_dir
)
Normalize the output path
job
(Job) — The joboutpath
(str) — The output pathis_dir
(bool) — Whether the path is a directory
The normalized path
pipen.pluginmgr.
get_mtime
(
job
, path
, dirsig
)
Get the mtime of a path, either a file or a directory
job
(Job) — The jobpath
(str | os.pathlike) — The path to get mtimedirsig
(int) — The depth of the directory to check the last modification time
The last modification time
pipen.pluginmgr.
clear_path
(
job
, path
, is_dir
)
Clear the path, either a file or a directory
job
(Job) — The jobpath
(str | os.pathlike) — The path to clearis_dir
(bool) — Whether the path is a directory
Whether the path is cleared successfully
pipen.pluginmgr.
output_exists
(
job
, path
, is_dir
)
Check if the output exists
job
(Job) — The jobpath
(str) — The path to checkis_dir
(bool) — Whether the path is a directory
Whether the output exists
pipen.pluginmgr.
on_jobcmd_init
(
job
)
When the job command wrapper script is initialized before the prescript is run
This should return a piece of bash code to be inserted in the wrapped job
script (template), which is a python template string, with the following
variables available: status
and job
. status
is the class JobStatus
from
xqute.defaults.py
and job
is the Job
instance.
For multiple plugins, the code will be inserted in the order of the plugin priority.
The code will replace the #![jobcmd_init]
placeholder in the wrapped job script.
See also https://github.com/pwwang/xqute/blob/master/xqute/defaults.py#L95
job
(Job) — The job object
The bash code to be inserted
pipen.pluginmgr.
on_jobcmd_prep
(
job
)
When the job command right about to be run
This should return a piece of bash code to be inserted in the wrapped job
script (template), which is a python template string, with the following
variables available: status
and job
. status
is the class JobStatus
from
xqute.defaults.py
and job
is the Job
instance.
The bash variable $cmd
is accessible in the context. It is also possible to
modify the cmd
variable. Just remember to assign the modified value to cmd
.
For multiple plugins, the code will be inserted in the order of the plugin priority.
Keep in mind that the $cmd
may be modified by other plugins.
The code will replace the #![jobcmd_prep]
placeholder in the wrapped job script.
See also https://github.com/pwwang/xqute/blob/master/xqute/defaults.py#L95
job
(Job) — The job object
The bash code to be inserted
pipen.pluginmgr.
on_jobcmd_end
(
job
)
When the job command finishes and after the postscript is run
This should return a piece of bash code to be inserted in the wrapped job
script (template), which is a python template string, with the following
variables available: status
and job
. status
is the class JobStatus
from
xqute.defaults.py
and job
is the Job
instance.
The bash variable $rc
is accessible in the context, which is the return code
of the job command.
For multiple plugins, the code will be inserted in the order of the plugin priority.
The code will replace the #![jobcmd_end]
placeholder in the wrapped job script.
See also https://github.com/pwwang/xqute/blob/master/xqute/defaults.py#L95
job
(Job) — The job object
The bash code to be inserted
pipen.pluginmgr.
PipenMainPlugin
(
)
The builtin core plugin, used to update the progress bar andcache the job
pipen.pluginmgr.
XqutePipenPlugin
(
)
The plugin for xqute working as proxy for pipen plugin hooks