diff --git a/Protos/V1/tasks_common.proto b/Protos/V1/tasks_common.proto index 9bf5c1a97..0caf684d1 100644 --- a/Protos/V1/tasks_common.proto +++ b/Protos/V1/tasks_common.proto @@ -40,6 +40,7 @@ message TaskDetailed { google.protobuf.Timestamp submitted_at = 12; /** The task submission date. */ google.protobuf.Timestamp received_at = 18; /** When the task is received by the agent. */ google.protobuf.Timestamp acquired_at = 19; /** When the task is acquired by the agent. */ + google.protobuf.Timestamp fetched_at = 25; /** Task data retrevial end date. */ google.protobuf.Timestamp started_at = 13; /** The task start date. */ google.protobuf.Timestamp processed_at = 24; /** The end of task processing date. */ google.protobuf.Timestamp ended_at = 14; /** The task end date. Also used when task failed. */ @@ -88,6 +89,7 @@ message TaskSummary { google.protobuf.Timestamp submitted_at = 12; /** The task submission date. */ google.protobuf.Timestamp received_at = 18; /** When the task is received by the agent. */ google.protobuf.Timestamp acquired_at = 19; /** When the task is acquired by the agent. */ + google.protobuf.Timestamp fetched_at = 25; /** Task data retrevial end date. */ google.protobuf.Timestamp started_at = 6; /** The task start date. */ google.protobuf.Timestamp processed_at = 23; /** The end of task processing date. */ google.protobuf.Timestamp ended_at = 7; /** The task end date. Also used when task failed. */ diff --git a/Protos/V1/tasks_fields.proto b/Protos/V1/tasks_fields.proto index 548686f13..300c14432 100644 --- a/Protos/V1/tasks_fields.proto +++ b/Protos/V1/tasks_fields.proto @@ -27,6 +27,7 @@ enum TaskSummaryEnumField { TASK_SUMMARY_ENUM_FIELD_ACQUIRED_AT = 15; /** When the task is acquired by the agent. */ TASK_SUMMARY_ENUM_FIELD_PROCESSED_AT = 17; /** When the task is processed by the agent. */ TASK_SUMMARY_ENUM_FIELD_ERROR = 8; /** The error message. Only set if task have failed. */ + TASK_SUMMARY_ENUM_FIELD_FETCHED_AT = 19; /** When task data are fetched by the agent. */ } /** diff --git a/packages/python/src/armonik/common/objects.py b/packages/python/src/armonik/common/objects.py index 2e4452503..7b3fade48 100644 --- a/packages/python/src/armonik/common/objects.py +++ b/packages/python/src/armonik/common/objects.py @@ -109,13 +109,15 @@ class Task: options: Optional[TaskOptions] = None created_at: Optional[datetime] = None submitted_at: Optional[datetime] = None + received_at: Optional[datetime] = None + acquired_at: Optional[datetime] = None + fetched_at: Optional[datetime] = None started_at: Optional[datetime] = None + processed_at: Optional[datetime] = None ended_at: Optional[datetime] = None pod_ttl: Optional[datetime] = None output: Optional[Output] = None pod_hostname: Optional[str] = None - received_at: Optional[datetime] = None - acquired_at: Optional[datetime] = None def refresh(self, task_client) -> None: """Refresh the fields of this task object by using the given task client @@ -135,13 +137,15 @@ def refresh(self, task_client) -> None: self.options = result.options self.created_at = result.created_at self.submitted_at = result.submitted_at + self.received_at = result.received_at + self.acquired_at = result.acquired_at + self.fetched_at = result.fetched_at self.started_at = result.started_at + self.processed_at = result.processed_at self.ended_at = result.ended_at self.pod_ttl = result.pod_ttl self.output = result.output self.pod_hostname = result.pod_hostname - self.received_at = result.received_at - self.acquired_at = result.acquired_at self.is_init = True @classmethod @@ -159,13 +163,15 @@ def from_message(cls, task_raw: TaskDetailed) -> "Task": options=TaskOptions.from_message(task_raw.options), created_at=timestamp_to_datetime(task_raw.created_at), submitted_at=timestamp_to_datetime(task_raw.submitted_at), + received_at=timestamp_to_datetime(task_raw.received_at), + acquired_at=timestamp_to_datetime(task_raw.acquired_at), + fetched_at=timestamp_to_datetime(task_raw.fetched_at), started_at=timestamp_to_datetime(task_raw.started_at), + processed_at=timestamp_to_datetime(task_raw.processed_at), ended_at=timestamp_to_datetime(task_raw.ended_at), pod_ttl=timestamp_to_datetime(task_raw.pod_ttl), output=Output(error=(task_raw.output.error if not task_raw.output.success else None)), pod_hostname=task_raw.pod_hostname, - received_at=timestamp_to_datetime(task_raw.received_at), - acquired_at=timestamp_to_datetime(task_raw.acquired_at), ) diff --git a/packages/python/tests/test_tasks.py b/packages/python/tests/test_tasks.py index 6297b3625..90d42c021 100644 --- a/packages/python/tests/test_tasks.py +++ b/packages/python/tests/test_tasks.py @@ -31,13 +31,15 @@ class TestArmoniKTasks: ), created_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), submitted_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), + received_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), + acquired_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), + fetched_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), started_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), + processed_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), ended_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), pod_ttl=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), output=Output(error=""), pod_hostname="", - received_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), - acquired_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), ) def test_get_task(self):