xqute.xqute
class
xqute.xqute.
Xqute
(
scheduler='local'
, plugins=None
, job_metadir=PosixPath('.xqute')
, job_submission_batch=8
, job_error_strategy='ignore'
, job_num_retries=3
, scheduler_forks=1
, scheduler_prescript=''
, scheduler_postscript=''
, **scheduler_opts
)
The main class of the package
Attributes
EMPTY_BUFFER_SLEEP_TIME
— The time to sleep while waiting whenthe buffer is empty_cancelling
— A mark to mark whether a shutting down eventis triggered (True for natual cancelling, the signale for cancelling with a signal, SIGINT for example)_job_error_strategy
— The strategy when there is error happened_job_metadir
— The job meta directory_job_num_retries
— The number of retries when strategy is retrybuffer_queue
— A buffer queue to save the pushed jobsjob_submission_batch
— The number of consumers to submit jobsjobs
— The jobs registryname
— The name, used in loggerplugins
— The plugins to be enabled or disabledto disable a plugin, using-plugin_name
either all plugin names should be prefixed with '+'/'-' or none of them shouldqueue
— The job queuescheduler
— The schedulertask
— The task of producer and consumers
Parameters
scheduler
(str | Type[Scheduler], optional) — The scheduler class or nameplugins
(Optional, optional) — The plugins to be enabled or disabledto disable a plugin, using-plugin_name
either all plugin names should be prefixed with '+'/'-' or none of them should To enabled plugins, objects arejob_metadir
(PathLike, optional) — The job meta directoryjob_submission_batch
(int, optional) — The number of consumers to submit jobsjob_error_strategy
(str, optional) — The strategy when there is error happenedjob_num_retries
(int, optional) — Max number of retries when job_error_strategy is retryscheduler_forks
(int, optional) — Max number of job forks**scheduler_opts
— Additional keyword arguments for scheduler
method
cancel
(
sig=None
)
Cancel the producer-consumer task
self._cancelling
will be set to signaled
if sig is provided,
otherwise it will be set to True
Parameters
sig
(signal.signals | none, optional) — Whether this cancelling is caused by a signal
method
put
(
cmd
)
Put a command into the buffer
Parameters
cmd
(Job | str | List[str]) — The command
method
run_until_complete
(
)
Wait until all jobs complete