Submission class
Bases: _Entity
, _Labeled
Submission of a submittable entity: Task
, a Sequence
or a Scenario
.
Task, Sequence, and Scenario entities can be submitted for execution. The submission represents the unique request to execute a submittable entity. The submission is created at the time the entity is submitted.
The submission holds the jobs created by the execution of the submittable and the
SubmissionStatus
. The status is lively updated by Taipy during the execution of the jobs.
Example
import taipy as tp
from taipy import Config
def by_two(x: int):
return x * 2
if __name__ == "__main__":
# Configure scenarios
input_cfg = Config.configure_data_node("my_input")
result_cfg = Config.configure_data_node("my_result")
task_cfg = Config.configure_task("my_double", function=by_two, input=input_cfg, output=result_cfg)
scenario_cfg = Config.configure_scenario("my_scenario", task_configs=[task_cfg])
# Create a new scenario from the configuration
scenario = tp.create_scenario(scenario_cfg)
# Write the input data and submit the scenario
scenario.my_input.write(3)
submission = scenario.submit()
# Retrieve the list of jobs, the submission status, and the creation date
jobs = submission.jobs
status = submission.submission_status
creation_date = submission.creation_date
Attributes¶
entity_config_id
property
¶
entity_config_id: Optional[str]
The config id of the entity that was submitted.
execution_duration
property
¶
execution_duration: Optional[float]
The duration of the submission execution in seconds.
The execution duration in seconds is the duration from the first job running to the last job completion. If no job was run, the execution duration is None. If at least one job is not finished, the execution duration is the duration from the first job running time to the current time.
finished_at
property
¶
finished_at: Optional[datetime]
The date and time when the submission was finished.
The finished date and time corresponds to the date and time of the last job that was completed. If at least one of the jobs is not finished, the finished date and time is None.
id
instance-attribute
¶
id: SubmissionId = id or __new_id()
The identifier of the Submission
entity.
run_at
property
¶
run_at: Optional[datetime]
The date and time when the submission was run.
The run date and time corresponds to the date and time of the first job that was run. If no job was run, the run date and time is None.
submission_status
property
writable
¶
submission_status: SubmissionStatus
The status of the submission.
submitted_at
property
¶
submitted_at: Optional[datetime]
The date and time when the submission was submitted.
The submitted date and time corresponds to the date and time of the first job that was submitted. If no job was submitted, the submitted date and time is None.
version
property
¶
version: str
The application version of the submission.
The string indicates the application version of the submission. If not provided, the latest version is used.
Methods¶
get_label() ¶
get_label() -> str
Returns the submission simple label prefixed by its owner label.
Returns:
Type | Description |
---|---|
str
|
The label of the submission as a string. |
get_simple_label() ¶
get_simple_label() -> str
Returns the submission simple label.
Returns:
Type | Description |
---|---|
str
|
The simple label of the submission as a string. |
is_deletable() ¶
is_deletable() -> ReasonCollection
Indicate if the submission can be deleted.
Returns:
Type | Description |
---|---|
ReasonCollection
|
A ReasonCollection object that can function as a Boolean value, which is True if the submission can be deleted. False otherwise. |
is_finished() ¶
is_finished() -> bool
Indicate if the submission is finished.
A submission is considered as finished if its submission status is
COMPLETED
, FAILED
, or CANCELED
.
Returns:
Type | Description |
---|---|
bool
|
True if the submission is finished. |