executejob¶
This module contains the following classes:
ExecuteJob
, a class to process a job;ExecuteJobExecutionError
,ExecuteJobInputError
, andExecuteJobOutputError
, representing errors generated while processing jobs.
-
class
aeneas.executejob.
ExecuteJob
(job=None, rconf=None, logger=None)[source]¶ Execute a job, that is, execute all of its tasks and generate the output container holding the generated sync maps.
If you do not provide a job object in the constructor, you must manually set it later, or load it from a container with
load_job_from_container()
.In the first case, you are responsible for setting the absolute audio/text/sync map paths of each task of the job, to their actual absolute location on the computing machine. Moreover, you are responsible for cleaning up any temporary files you might have generated around.
In the second case, you are responsible for calling
clean()
at the end of the job execution, to delete the working directory created byload_job_from_container()
when creating the job object.Parameters: - job (
Job
) – the job to be executed - rconf (
RuntimeConfiguration
) – a runtime configuration - logger (
Logger
) – the logger object
Raises: ExecuteJobInputError
: ifjob
is not an instance ofJob
-
clean
(remove_working_directory=True)[source]¶ Remove the temporary directory. If
remove_working_directory
isTrue
remove the working directory as well, otherwise just remove the temporary directory.Parameters: remove_working_directory (bool) – if True
, remove the working directory as well
-
execute
()[source]¶ Execute the job, that is, execute all of its tasks.
Each produced sync map will be stored inside the corresponding task object.
Raises: ExecuteJobExecutionError
: if there is a problem during the job execution
-
load_job
(job)[source]¶ Load the job from the given
Job
object.Parameters: job ( Job
) – the job to loadRaises: ExecuteJobInputError
: ifjob
is not an instance ofJob
-
load_job_from_container
(container_path, config_string=None)[source]¶ Load the job from the given
aeneas.container.Container
object.If
config_string
isNone
, the container must contain a configuration file; otherwise use the provided config string (i.e., the wizard case).Parameters: - container_path (string) – the path to the input container
- config_string (string) – the configuration string (from wizard)
Raises: ExecuteJobInputError
: if the given container does not contain a validJob
-
write_output_container
(output_directory_path)[source]¶ Write the output container for this job.
Return the path to output container, which is the concatenation of
output_directory_path
and of the output container file or directory name.Parameters: output_directory_path (string) – the path to a directory where the output container must be created Return type: string Raises: ExecuteJobOutputError
: if there is a problem while writing the output container
- job (
-
exception
aeneas.executejob.
ExecuteJobExecutionError
[source]¶ Error raised when the execution of the job fails for internal reasons.