quickie.tasks.Script
- class quickie.tasks.Script(*args, script: str | None = None, executable: str | None = None, **kwargs)
Base class for tasks that run a script.
- __init__(*args, script: str | None = None, executable: str | None = None, **kwargs)
Initialize the task.
- Parameters:
args – Task instance arguments.
script – The script to run.
executable – The executable to use to run the script.
kwargs – Task instance keyword arguments.
Methods
__init__(*args[, script, executable])Initialize the task.
add_args(parser)Add arguments to the parser.
condition_passes(*args, **kwargs)Check the condition before running the task.
full_run(*args, **kwargs)Execute the full task lifecycle and return the result of
run().get_after(*args, **kwargs)Get the tasks to run after this task.
get_before(*args, **kwargs)Get the tasks to run before this task.
get_cleanup(*args, **kwargs)Get the tasks to run after this task, even if it fails.
get_env(*args, **kwargs)Get the environment.
get_expected_exit_codes(*args, **kwargs)Get accepted subprocess exit codes.
get_help()Get the help message of the task.
get_parser(*[, name])Get the parser for the task.
get_plain_usage()Return the usage string without ANSI escape sequences.
get_retries()Get the number of additional retry attempts.
get_retry_delay()Get the seconds to wait between retry attempts.
get_script(*args, **kwargs)Get the script to run.
get_short_help()Get the short help message of the task.
get_timeout()Get the subprocess timeout in seconds.
get_wd(*args, **kwargs)Get the working directory.
log_task_execution(*args, **kwargs)Log information about the task execution.
log_task_execution_details(script)Log details about the task execution.
parse_and_run(args)Parse arguments and run the task.
parse_args(*, parser, args, extra_args)Parse arguments.
run(*args, **kwargs)Run the main work of this task.
run_after(*args, **kwargs)Run the tasks after this task.
run_before(*args, **kwargs)Run the tasks before this task.
run_cleanup(*args, **kwargs)Run the tasks after this task, even if it fails.
to_info_dict(cwd)Serialise task metadata to a plain dict suitable for JSON output.
validate_exit_code(*, return_code, command, ...)Validate the subprocess return code.
Attributes
afterTasks to run after this task.
argsArguments for the task.
beforeTasks to run before this task.
cleanupTasks to run at the end, even if the task, or before or after tasks fail.
conditionThe condition to check before running the task.
envThe environment.
env_filePath to a
.envfile whose variables are merged into the environment.executableexpected_exit_codesAccepted subprocess exit codes.
extra_argsWhether to allow extra command line arguments.
output_modeControls how subprocess output is handled.
parserParser for the task.
retriesNumber of additional attempts after an initial failure.
retry_delaySeconds to wait between retry attempts.
scripttimeoutTimeout in seconds for each subprocess attempt.
wdThe current working directory.