mlops-python-sdk 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. mlops/__init__.py +46 -0
  2. mlops/api/client/__init__.py +8 -0
  3. mlops/api/client/api/__init__.py +1 -0
  4. mlops/api/client/api/tasks/__init__.py +1 -0
  5. mlops/api/client/api/tasks/cancel_task.py +196 -0
  6. mlops/api/client/api/tasks/delete_task.py +204 -0
  7. mlops/api/client/api/tasks/get_task.py +196 -0
  8. mlops/api/client/api/tasks/list_tasks.py +255 -0
  9. mlops/api/client/api/tasks/submit_task.py +188 -0
  10. mlops/api/client/client.py +268 -0
  11. mlops/api/client/errors.py +16 -0
  12. mlops/api/client/models/__init__.py +33 -0
  13. mlops/api/client/models/error_response.py +68 -0
  14. mlops/api/client/models/message_response.py +59 -0
  15. mlops/api/client/models/task.py +1629 -0
  16. mlops/api/client/models/task_alloc_tres_type_0.py +49 -0
  17. mlops/api/client/models/task_gres_detail_type_0_item.py +44 -0
  18. mlops/api/client/models/task_job_resources_type_0.py +49 -0
  19. mlops/api/client/models/task_list_response.py +102 -0
  20. mlops/api/client/models/task_resources_type_0.py +49 -0
  21. mlops/api/client/models/task_status.py +15 -0
  22. mlops/api/client/models/task_submit_request.py +640 -0
  23. mlops/api/client/models/task_submit_request_environment_type_0.py +49 -0
  24. mlops/api/client/models/task_submit_response.py +78 -0
  25. mlops/api/client/models/task_tres_type_0.py +49 -0
  26. mlops/api/client/models/task_tres_used_type_0.py +49 -0
  27. mlops/api/client/py.typed +1 -0
  28. mlops/api/client/types.py +54 -0
  29. mlops/connection_config.py +106 -0
  30. mlops/exceptions.py +82 -0
  31. mlops/task/__init__.py +10 -0
  32. mlops/task/client.py +146 -0
  33. mlops/task/task.py +464 -0
  34. mlops_python_sdk-0.0.1.dist-info/METADATA +416 -0
  35. mlops_python_sdk-0.0.1.dist-info/RECORD +36 -0
  36. mlops_python_sdk-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,1629 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+ from dateutil.parser import isoparse
8
+
9
+ from ..models.task_status import TaskStatus
10
+ from ..types import UNSET, Unset
11
+
12
+ if TYPE_CHECKING:
13
+ from ..models.task_alloc_tres_type_0 import TaskAllocTresType0
14
+ from ..models.task_gres_detail_type_0_item import TaskGresDetailType0Item
15
+ from ..models.task_job_resources_type_0 import TaskJobResourcesType0
16
+ from ..models.task_resources_type_0 import TaskResourcesType0
17
+ from ..models.task_tres_type_0 import TaskTresType0
18
+ from ..models.task_tres_used_type_0 import TaskTresUsedType0
19
+
20
+
21
+ T = TypeVar("T", bound="Task")
22
+
23
+
24
+ @_attrs_define
25
+ class Task:
26
+ """Task representation
27
+
28
+ Attributes:
29
+ account (Union[None, Unset, str]): Slurm account Example: research.
30
+ alloc_tres (Union['TaskAllocTresType0', None, Unset]): Allocated Trackable Resources Example: {'cpu': 4, 'mem':
31
+ 8589934592}.
32
+ array_job_id (Union[None, Unset, int]): Array job ID Example: 12345.
33
+ array_task_id (Union[None, Unset, int]): Array task ID Example: 1.
34
+ attempt_id (Union[Unset, str]): Attempt ID (UUID) - Task attempt identifier Example:
35
+ 660e8400-e29b-41d4-a716-446655440001.
36
+ batch_features (Union[None, Unset, str]): Batch features
37
+ batch_host (Union[None, Unset, str]): Batch host Example: node001.
38
+ cluster (Union[None, Unset, str]): Cluster name Example: main-cluster.
39
+ cluster_id (Union[None, Unset, int]): Example: 1.
40
+ command (Union[None, Unset, str]): Example: python train.py.
41
+ comment (Union[None, Unset, str]): Task comment Example: Machine learning training job.
42
+ completed_at (Union[None, Unset, datetime.datetime]): Example: 2024-01-01T00:00:00Z.
43
+ cpus (Union[None, Unset, int]): Example: 4.
44
+ cpus_per_task (Union[None, Unset, int]): CPUs per task Example: 1.
45
+ created_at (Union[Unset, datetime.datetime]): Example: 2024-01-01T00:00:00Z.
46
+ current_working_directory (Union[None, Unset, str]): Current working directory Example: /home/user/project.
47
+ deadline (Union[None, Unset, datetime.datetime]): Deadline
48
+ eligible_at (Union[None, Unset, datetime.datetime]): When the task becomes eligible for scheduling Example:
49
+ 2024-01-01T00:00:00Z.
50
+ end_time (Union[None, Unset, datetime.datetime]): End time Example: 2024-01-01T01:00:00Z.
51
+ exit_code (Union[None, Unset, int]):
52
+ flags (Union[None, Unset, list[str]]): Job flags
53
+ gres_detail (Union[None, Unset, list['TaskGresDetailType0Item']]): GRES detail
54
+ group_id (Union[None, Unset, int]): Group ID Example: 1000.
55
+ group_name (Union[None, Unset, str]): Group name Example: researchers.
56
+ id (Union[Unset, int]): Database ID (slurm_jobs.id) Example: 1.
57
+ job_id (Union[Unset, str]): Slurm Job ID Example: 12345.
58
+ job_resources (Union['TaskJobResourcesType0', None, Unset]): Job resources (nodes, allocated CPUs, etc.)
59
+ Example: {'allocated_cpus': 4, 'nodes': ['node001']}.
60
+ last_sched_evaluation_at (Union[None, Unset, datetime.datetime]): Last time the scheduler evaluated this task
61
+ Example: 2024-01-01T00:00:00Z.
62
+ memory (Union[None, Unset, int]): Memory in bytes Example: 8589934592.
63
+ minimum_cpus_per_node (Union[None, Unset, int]): Minimum CPUs per node Example: 1.
64
+ minimum_tmp_disk_per_node (Union[None, Unset, int]): Minimum temporary disk per node
65
+ name (Union[Unset, str]): Example: training-job.
66
+ node_count (Union[None, Unset, int]): Number of nodes Example: 1.
67
+ nodes (Union[None, Unset, list[str]]): Example: ['node1', 'node2'].
68
+ partition (Union[None, Unset, str]): Example: debug.
69
+ pre_sus_time (Union[None, Unset, int]): Pre-suspension time in seconds
70
+ priority (Union[None, Unset, int]): Example: 4294901756.
71
+ qos (Union[None, Unset, str]): Quality of Service Example: normal.
72
+ requeue (Union[None, Unset, bool]): Whether requeue is enabled
73
+ resize_time (Union[None, Unset, datetime.datetime]): Resize time
74
+ resources (Union['TaskResourcesType0', None, Unset]): Resource requirements (JSON format) Example: {'cpu': 4,
75
+ 'gpu': 1, 'memory': '8GB'}.
76
+ restart_count (Union[None, Unset, int]): Restart count
77
+ script (Union[None, Unset, str]): Example: #!/bin/bash
78
+ python train.py.
79
+ slurm_state (Union[None, Unset, str]): Slurm job state Example: RUNNING.
80
+ standard_error (Union[None, Unset, str]): Standard error file path Example: /home/user/error.log.
81
+ standard_input (Union[None, Unset, str]): Standard input file path
82
+ standard_output (Union[None, Unset, str]): Standard output file path Example: /home/user/output.log.
83
+ started_at (Union[None, Unset, datetime.datetime]): Example: 2024-01-01T00:00:00Z.
84
+ state_description (Union[None, Unset, str]): State description
85
+ state_reason (Union[None, Unset, str]): State reason
86
+ status (Union[Unset, TaskStatus]): Task status Example: pending.
87
+ std_err (Union[None, Unset, str]): Standard error file Example: /home/user/error.log.
88
+ std_in (Union[None, Unset, str]): Standard input file
89
+ std_out (Union[None, Unset, str]): Standard output file Example: /home/user/output.log.
90
+ submit_time (Union[None, Unset, datetime.datetime]): Submit time Example: 2024-01-01T00:00:00Z.
91
+ submit_user_id (Union[None, Unset, int]): Submit user ID Example: 1.
92
+ submit_user_name (Union[None, Unset, str]): Submit user name Example: john.
93
+ suspend_time (Union[None, Unset, datetime.datetime]): Suspend time
94
+ task_count (Union[None, Unset, int]): Number of tasks Example: 4.
95
+ task_id (Union[Unset, str]): Task ID (UUID) - Business task identifier Example:
96
+ 550e8400-e29b-41d4-a716-446655440000.
97
+ tasks (Union[None, Unset, int]): Number of tasks Example: 1.
98
+ team_id (Union[None, Unset, int]): Example: 1.
99
+ time_limit (Union[None, Unset, int]): Time limit in seconds Example: 3600.
100
+ time_used (Union[None, Unset, int]): Time used in seconds Example: 3600.
101
+ tres (Union['TaskTresType0', None, Unset]): Trackable Resources Example: {'cpu': 4, 'mem': 8589934592}.
102
+ tres_alloc_str (Union[None, Unset, str]): TRES allocation string Example: cpu=4,mem=8G.
103
+ tres_req_str (Union[None, Unset, str]): TRES request string Example: cpu=4,mem=8G.
104
+ tres_used (Union['TaskTresUsedType0', None, Unset]): Trackable Resources Used Example: {'cpu': 4, 'mem':
105
+ 4294967296}.
106
+ updated_at (Union[Unset, datetime.datetime]): Example: 2024-01-01T00:00:00Z.
107
+ user_id (Union[Unset, int]): Example: 1.
108
+ user_name (Union[None, Unset, str]): User name Example: john.
109
+ work_dir (Union[None, Unset, str]): Example: /home/user.
110
+ """
111
+
112
+ account: Union[None, Unset, str] = UNSET
113
+ alloc_tres: Union["TaskAllocTresType0", None, Unset] = UNSET
114
+ array_job_id: Union[None, Unset, int] = UNSET
115
+ array_task_id: Union[None, Unset, int] = UNSET
116
+ attempt_id: Union[Unset, str] = UNSET
117
+ batch_features: Union[None, Unset, str] = UNSET
118
+ batch_host: Union[None, Unset, str] = UNSET
119
+ cluster: Union[None, Unset, str] = UNSET
120
+ cluster_id: Union[None, Unset, int] = UNSET
121
+ command: Union[None, Unset, str] = UNSET
122
+ comment: Union[None, Unset, str] = UNSET
123
+ completed_at: Union[None, Unset, datetime.datetime] = UNSET
124
+ cpus: Union[None, Unset, int] = UNSET
125
+ cpus_per_task: Union[None, Unset, int] = UNSET
126
+ created_at: Union[Unset, datetime.datetime] = UNSET
127
+ current_working_directory: Union[None, Unset, str] = UNSET
128
+ deadline: Union[None, Unset, datetime.datetime] = UNSET
129
+ eligible_at: Union[None, Unset, datetime.datetime] = UNSET
130
+ end_time: Union[None, Unset, datetime.datetime] = UNSET
131
+ exit_code: Union[None, Unset, int] = UNSET
132
+ flags: Union[None, Unset, list[str]] = UNSET
133
+ gres_detail: Union[None, Unset, list["TaskGresDetailType0Item"]] = UNSET
134
+ group_id: Union[None, Unset, int] = UNSET
135
+ group_name: Union[None, Unset, str] = UNSET
136
+ id: Union[Unset, int] = UNSET
137
+ job_id: Union[Unset, str] = UNSET
138
+ job_resources: Union["TaskJobResourcesType0", None, Unset] = UNSET
139
+ last_sched_evaluation_at: Union[None, Unset, datetime.datetime] = UNSET
140
+ memory: Union[None, Unset, int] = UNSET
141
+ minimum_cpus_per_node: Union[None, Unset, int] = UNSET
142
+ minimum_tmp_disk_per_node: Union[None, Unset, int] = UNSET
143
+ name: Union[Unset, str] = UNSET
144
+ node_count: Union[None, Unset, int] = UNSET
145
+ nodes: Union[None, Unset, list[str]] = UNSET
146
+ partition: Union[None, Unset, str] = UNSET
147
+ pre_sus_time: Union[None, Unset, int] = UNSET
148
+ priority: Union[None, Unset, int] = UNSET
149
+ qos: Union[None, Unset, str] = UNSET
150
+ requeue: Union[None, Unset, bool] = UNSET
151
+ resize_time: Union[None, Unset, datetime.datetime] = UNSET
152
+ resources: Union["TaskResourcesType0", None, Unset] = UNSET
153
+ restart_count: Union[None, Unset, int] = UNSET
154
+ script: Union[None, Unset, str] = UNSET
155
+ slurm_state: Union[None, Unset, str] = UNSET
156
+ standard_error: Union[None, Unset, str] = UNSET
157
+ standard_input: Union[None, Unset, str] = UNSET
158
+ standard_output: Union[None, Unset, str] = UNSET
159
+ started_at: Union[None, Unset, datetime.datetime] = UNSET
160
+ state_description: Union[None, Unset, str] = UNSET
161
+ state_reason: Union[None, Unset, str] = UNSET
162
+ status: Union[Unset, TaskStatus] = UNSET
163
+ std_err: Union[None, Unset, str] = UNSET
164
+ std_in: Union[None, Unset, str] = UNSET
165
+ std_out: Union[None, Unset, str] = UNSET
166
+ submit_time: Union[None, Unset, datetime.datetime] = UNSET
167
+ submit_user_id: Union[None, Unset, int] = UNSET
168
+ submit_user_name: Union[None, Unset, str] = UNSET
169
+ suspend_time: Union[None, Unset, datetime.datetime] = UNSET
170
+ task_count: Union[None, Unset, int] = UNSET
171
+ task_id: Union[Unset, str] = UNSET
172
+ tasks: Union[None, Unset, int] = UNSET
173
+ team_id: Union[None, Unset, int] = UNSET
174
+ time_limit: Union[None, Unset, int] = UNSET
175
+ time_used: Union[None, Unset, int] = UNSET
176
+ tres: Union["TaskTresType0", None, Unset] = UNSET
177
+ tres_alloc_str: Union[None, Unset, str] = UNSET
178
+ tres_req_str: Union[None, Unset, str] = UNSET
179
+ tres_used: Union["TaskTresUsedType0", None, Unset] = UNSET
180
+ updated_at: Union[Unset, datetime.datetime] = UNSET
181
+ user_id: Union[Unset, int] = UNSET
182
+ user_name: Union[None, Unset, str] = UNSET
183
+ work_dir: Union[None, Unset, str] = UNSET
184
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
185
+
186
+ def to_dict(self) -> dict[str, Any]:
187
+ from ..models.task_alloc_tres_type_0 import TaskAllocTresType0
188
+ from ..models.task_job_resources_type_0 import TaskJobResourcesType0
189
+ from ..models.task_resources_type_0 import TaskResourcesType0
190
+ from ..models.task_tres_type_0 import TaskTresType0
191
+ from ..models.task_tres_used_type_0 import TaskTresUsedType0
192
+
193
+ account: Union[None, Unset, str]
194
+ if isinstance(self.account, Unset):
195
+ account = UNSET
196
+ else:
197
+ account = self.account
198
+
199
+ alloc_tres: Union[None, Unset, dict[str, Any]]
200
+ if isinstance(self.alloc_tres, Unset):
201
+ alloc_tres = UNSET
202
+ elif isinstance(self.alloc_tres, TaskAllocTresType0):
203
+ alloc_tres = self.alloc_tres.to_dict()
204
+ else:
205
+ alloc_tres = self.alloc_tres
206
+
207
+ array_job_id: Union[None, Unset, int]
208
+ if isinstance(self.array_job_id, Unset):
209
+ array_job_id = UNSET
210
+ else:
211
+ array_job_id = self.array_job_id
212
+
213
+ array_task_id: Union[None, Unset, int]
214
+ if isinstance(self.array_task_id, Unset):
215
+ array_task_id = UNSET
216
+ else:
217
+ array_task_id = self.array_task_id
218
+
219
+ attempt_id = self.attempt_id
220
+
221
+ batch_features: Union[None, Unset, str]
222
+ if isinstance(self.batch_features, Unset):
223
+ batch_features = UNSET
224
+ else:
225
+ batch_features = self.batch_features
226
+
227
+ batch_host: Union[None, Unset, str]
228
+ if isinstance(self.batch_host, Unset):
229
+ batch_host = UNSET
230
+ else:
231
+ batch_host = self.batch_host
232
+
233
+ cluster: Union[None, Unset, str]
234
+ if isinstance(self.cluster, Unset):
235
+ cluster = UNSET
236
+ else:
237
+ cluster = self.cluster
238
+
239
+ cluster_id: Union[None, Unset, int]
240
+ if isinstance(self.cluster_id, Unset):
241
+ cluster_id = UNSET
242
+ else:
243
+ cluster_id = self.cluster_id
244
+
245
+ command: Union[None, Unset, str]
246
+ if isinstance(self.command, Unset):
247
+ command = UNSET
248
+ else:
249
+ command = self.command
250
+
251
+ comment: Union[None, Unset, str]
252
+ if isinstance(self.comment, Unset):
253
+ comment = UNSET
254
+ else:
255
+ comment = self.comment
256
+
257
+ completed_at: Union[None, Unset, str]
258
+ if isinstance(self.completed_at, Unset):
259
+ completed_at = UNSET
260
+ elif isinstance(self.completed_at, datetime.datetime):
261
+ completed_at = self.completed_at.isoformat()
262
+ else:
263
+ completed_at = self.completed_at
264
+
265
+ cpus: Union[None, Unset, int]
266
+ if isinstance(self.cpus, Unset):
267
+ cpus = UNSET
268
+ else:
269
+ cpus = self.cpus
270
+
271
+ cpus_per_task: Union[None, Unset, int]
272
+ if isinstance(self.cpus_per_task, Unset):
273
+ cpus_per_task = UNSET
274
+ else:
275
+ cpus_per_task = self.cpus_per_task
276
+
277
+ created_at: Union[Unset, str] = UNSET
278
+ if not isinstance(self.created_at, Unset):
279
+ created_at = self.created_at.isoformat()
280
+
281
+ current_working_directory: Union[None, Unset, str]
282
+ if isinstance(self.current_working_directory, Unset):
283
+ current_working_directory = UNSET
284
+ else:
285
+ current_working_directory = self.current_working_directory
286
+
287
+ deadline: Union[None, Unset, str]
288
+ if isinstance(self.deadline, Unset):
289
+ deadline = UNSET
290
+ elif isinstance(self.deadline, datetime.datetime):
291
+ deadline = self.deadline.isoformat()
292
+ else:
293
+ deadline = self.deadline
294
+
295
+ eligible_at: Union[None, Unset, str]
296
+ if isinstance(self.eligible_at, Unset):
297
+ eligible_at = UNSET
298
+ elif isinstance(self.eligible_at, datetime.datetime):
299
+ eligible_at = self.eligible_at.isoformat()
300
+ else:
301
+ eligible_at = self.eligible_at
302
+
303
+ end_time: Union[None, Unset, str]
304
+ if isinstance(self.end_time, Unset):
305
+ end_time = UNSET
306
+ elif isinstance(self.end_time, datetime.datetime):
307
+ end_time = self.end_time.isoformat()
308
+ else:
309
+ end_time = self.end_time
310
+
311
+ exit_code: Union[None, Unset, int]
312
+ if isinstance(self.exit_code, Unset):
313
+ exit_code = UNSET
314
+ else:
315
+ exit_code = self.exit_code
316
+
317
+ flags: Union[None, Unset, list[str]]
318
+ if isinstance(self.flags, Unset):
319
+ flags = UNSET
320
+ elif isinstance(self.flags, list):
321
+ flags = self.flags
322
+
323
+ else:
324
+ flags = self.flags
325
+
326
+ gres_detail: Union[None, Unset, list[dict[str, Any]]]
327
+ if isinstance(self.gres_detail, Unset):
328
+ gres_detail = UNSET
329
+ elif isinstance(self.gres_detail, list):
330
+ gres_detail = []
331
+ for gres_detail_type_0_item_data in self.gres_detail:
332
+ gres_detail_type_0_item = gres_detail_type_0_item_data.to_dict()
333
+ gres_detail.append(gres_detail_type_0_item)
334
+
335
+ else:
336
+ gres_detail = self.gres_detail
337
+
338
+ group_id: Union[None, Unset, int]
339
+ if isinstance(self.group_id, Unset):
340
+ group_id = UNSET
341
+ else:
342
+ group_id = self.group_id
343
+
344
+ group_name: Union[None, Unset, str]
345
+ if isinstance(self.group_name, Unset):
346
+ group_name = UNSET
347
+ else:
348
+ group_name = self.group_name
349
+
350
+ id = self.id
351
+
352
+ job_id = self.job_id
353
+
354
+ job_resources: Union[None, Unset, dict[str, Any]]
355
+ if isinstance(self.job_resources, Unset):
356
+ job_resources = UNSET
357
+ elif isinstance(self.job_resources, TaskJobResourcesType0):
358
+ job_resources = self.job_resources.to_dict()
359
+ else:
360
+ job_resources = self.job_resources
361
+
362
+ last_sched_evaluation_at: Union[None, Unset, str]
363
+ if isinstance(self.last_sched_evaluation_at, Unset):
364
+ last_sched_evaluation_at = UNSET
365
+ elif isinstance(self.last_sched_evaluation_at, datetime.datetime):
366
+ last_sched_evaluation_at = self.last_sched_evaluation_at.isoformat()
367
+ else:
368
+ last_sched_evaluation_at = self.last_sched_evaluation_at
369
+
370
+ memory: Union[None, Unset, int]
371
+ if isinstance(self.memory, Unset):
372
+ memory = UNSET
373
+ else:
374
+ memory = self.memory
375
+
376
+ minimum_cpus_per_node: Union[None, Unset, int]
377
+ if isinstance(self.minimum_cpus_per_node, Unset):
378
+ minimum_cpus_per_node = UNSET
379
+ else:
380
+ minimum_cpus_per_node = self.minimum_cpus_per_node
381
+
382
+ minimum_tmp_disk_per_node: Union[None, Unset, int]
383
+ if isinstance(self.minimum_tmp_disk_per_node, Unset):
384
+ minimum_tmp_disk_per_node = UNSET
385
+ else:
386
+ minimum_tmp_disk_per_node = self.minimum_tmp_disk_per_node
387
+
388
+ name = self.name
389
+
390
+ node_count: Union[None, Unset, int]
391
+ if isinstance(self.node_count, Unset):
392
+ node_count = UNSET
393
+ else:
394
+ node_count = self.node_count
395
+
396
+ nodes: Union[None, Unset, list[str]]
397
+ if isinstance(self.nodes, Unset):
398
+ nodes = UNSET
399
+ elif isinstance(self.nodes, list):
400
+ nodes = self.nodes
401
+
402
+ else:
403
+ nodes = self.nodes
404
+
405
+ partition: Union[None, Unset, str]
406
+ if isinstance(self.partition, Unset):
407
+ partition = UNSET
408
+ else:
409
+ partition = self.partition
410
+
411
+ pre_sus_time: Union[None, Unset, int]
412
+ if isinstance(self.pre_sus_time, Unset):
413
+ pre_sus_time = UNSET
414
+ else:
415
+ pre_sus_time = self.pre_sus_time
416
+
417
+ priority: Union[None, Unset, int]
418
+ if isinstance(self.priority, Unset):
419
+ priority = UNSET
420
+ else:
421
+ priority = self.priority
422
+
423
+ qos: Union[None, Unset, str]
424
+ if isinstance(self.qos, Unset):
425
+ qos = UNSET
426
+ else:
427
+ qos = self.qos
428
+
429
+ requeue: Union[None, Unset, bool]
430
+ if isinstance(self.requeue, Unset):
431
+ requeue = UNSET
432
+ else:
433
+ requeue = self.requeue
434
+
435
+ resize_time: Union[None, Unset, str]
436
+ if isinstance(self.resize_time, Unset):
437
+ resize_time = UNSET
438
+ elif isinstance(self.resize_time, datetime.datetime):
439
+ resize_time = self.resize_time.isoformat()
440
+ else:
441
+ resize_time = self.resize_time
442
+
443
+ resources: Union[None, Unset, dict[str, Any]]
444
+ if isinstance(self.resources, Unset):
445
+ resources = UNSET
446
+ elif isinstance(self.resources, TaskResourcesType0):
447
+ resources = self.resources.to_dict()
448
+ else:
449
+ resources = self.resources
450
+
451
+ restart_count: Union[None, Unset, int]
452
+ if isinstance(self.restart_count, Unset):
453
+ restart_count = UNSET
454
+ else:
455
+ restart_count = self.restart_count
456
+
457
+ script: Union[None, Unset, str]
458
+ if isinstance(self.script, Unset):
459
+ script = UNSET
460
+ else:
461
+ script = self.script
462
+
463
+ slurm_state: Union[None, Unset, str]
464
+ if isinstance(self.slurm_state, Unset):
465
+ slurm_state = UNSET
466
+ else:
467
+ slurm_state = self.slurm_state
468
+
469
+ standard_error: Union[None, Unset, str]
470
+ if isinstance(self.standard_error, Unset):
471
+ standard_error = UNSET
472
+ else:
473
+ standard_error = self.standard_error
474
+
475
+ standard_input: Union[None, Unset, str]
476
+ if isinstance(self.standard_input, Unset):
477
+ standard_input = UNSET
478
+ else:
479
+ standard_input = self.standard_input
480
+
481
+ standard_output: Union[None, Unset, str]
482
+ if isinstance(self.standard_output, Unset):
483
+ standard_output = UNSET
484
+ else:
485
+ standard_output = self.standard_output
486
+
487
+ started_at: Union[None, Unset, str]
488
+ if isinstance(self.started_at, Unset):
489
+ started_at = UNSET
490
+ elif isinstance(self.started_at, datetime.datetime):
491
+ started_at = self.started_at.isoformat()
492
+ else:
493
+ started_at = self.started_at
494
+
495
+ state_description: Union[None, Unset, str]
496
+ if isinstance(self.state_description, Unset):
497
+ state_description = UNSET
498
+ else:
499
+ state_description = self.state_description
500
+
501
+ state_reason: Union[None, Unset, str]
502
+ if isinstance(self.state_reason, Unset):
503
+ state_reason = UNSET
504
+ else:
505
+ state_reason = self.state_reason
506
+
507
+ status: Union[Unset, str] = UNSET
508
+ if not isinstance(self.status, Unset):
509
+ status = self.status.value
510
+
511
+ std_err: Union[None, Unset, str]
512
+ if isinstance(self.std_err, Unset):
513
+ std_err = UNSET
514
+ else:
515
+ std_err = self.std_err
516
+
517
+ std_in: Union[None, Unset, str]
518
+ if isinstance(self.std_in, Unset):
519
+ std_in = UNSET
520
+ else:
521
+ std_in = self.std_in
522
+
523
+ std_out: Union[None, Unset, str]
524
+ if isinstance(self.std_out, Unset):
525
+ std_out = UNSET
526
+ else:
527
+ std_out = self.std_out
528
+
529
+ submit_time: Union[None, Unset, str]
530
+ if isinstance(self.submit_time, Unset):
531
+ submit_time = UNSET
532
+ elif isinstance(self.submit_time, datetime.datetime):
533
+ submit_time = self.submit_time.isoformat()
534
+ else:
535
+ submit_time = self.submit_time
536
+
537
+ submit_user_id: Union[None, Unset, int]
538
+ if isinstance(self.submit_user_id, Unset):
539
+ submit_user_id = UNSET
540
+ else:
541
+ submit_user_id = self.submit_user_id
542
+
543
+ submit_user_name: Union[None, Unset, str]
544
+ if isinstance(self.submit_user_name, Unset):
545
+ submit_user_name = UNSET
546
+ else:
547
+ submit_user_name = self.submit_user_name
548
+
549
+ suspend_time: Union[None, Unset, str]
550
+ if isinstance(self.suspend_time, Unset):
551
+ suspend_time = UNSET
552
+ elif isinstance(self.suspend_time, datetime.datetime):
553
+ suspend_time = self.suspend_time.isoformat()
554
+ else:
555
+ suspend_time = self.suspend_time
556
+
557
+ task_count: Union[None, Unset, int]
558
+ if isinstance(self.task_count, Unset):
559
+ task_count = UNSET
560
+ else:
561
+ task_count = self.task_count
562
+
563
+ task_id = self.task_id
564
+
565
+ tasks: Union[None, Unset, int]
566
+ if isinstance(self.tasks, Unset):
567
+ tasks = UNSET
568
+ else:
569
+ tasks = self.tasks
570
+
571
+ team_id: Union[None, Unset, int]
572
+ if isinstance(self.team_id, Unset):
573
+ team_id = UNSET
574
+ else:
575
+ team_id = self.team_id
576
+
577
+ time_limit: Union[None, Unset, int]
578
+ if isinstance(self.time_limit, Unset):
579
+ time_limit = UNSET
580
+ else:
581
+ time_limit = self.time_limit
582
+
583
+ time_used: Union[None, Unset, int]
584
+ if isinstance(self.time_used, Unset):
585
+ time_used = UNSET
586
+ else:
587
+ time_used = self.time_used
588
+
589
+ tres: Union[None, Unset, dict[str, Any]]
590
+ if isinstance(self.tres, Unset):
591
+ tres = UNSET
592
+ elif isinstance(self.tres, TaskTresType0):
593
+ tres = self.tres.to_dict()
594
+ else:
595
+ tres = self.tres
596
+
597
+ tres_alloc_str: Union[None, Unset, str]
598
+ if isinstance(self.tres_alloc_str, Unset):
599
+ tres_alloc_str = UNSET
600
+ else:
601
+ tres_alloc_str = self.tres_alloc_str
602
+
603
+ tres_req_str: Union[None, Unset, str]
604
+ if isinstance(self.tres_req_str, Unset):
605
+ tres_req_str = UNSET
606
+ else:
607
+ tres_req_str = self.tres_req_str
608
+
609
+ tres_used: Union[None, Unset, dict[str, Any]]
610
+ if isinstance(self.tres_used, Unset):
611
+ tres_used = UNSET
612
+ elif isinstance(self.tres_used, TaskTresUsedType0):
613
+ tres_used = self.tres_used.to_dict()
614
+ else:
615
+ tres_used = self.tres_used
616
+
617
+ updated_at: Union[Unset, str] = UNSET
618
+ if not isinstance(self.updated_at, Unset):
619
+ updated_at = self.updated_at.isoformat()
620
+
621
+ user_id = self.user_id
622
+
623
+ user_name: Union[None, Unset, str]
624
+ if isinstance(self.user_name, Unset):
625
+ user_name = UNSET
626
+ else:
627
+ user_name = self.user_name
628
+
629
+ work_dir: Union[None, Unset, str]
630
+ if isinstance(self.work_dir, Unset):
631
+ work_dir = UNSET
632
+ else:
633
+ work_dir = self.work_dir
634
+
635
+ field_dict: dict[str, Any] = {}
636
+ field_dict.update(self.additional_properties)
637
+ field_dict.update({})
638
+ if account is not UNSET:
639
+ field_dict["account"] = account
640
+ if alloc_tres is not UNSET:
641
+ field_dict["alloc_tres"] = alloc_tres
642
+ if array_job_id is not UNSET:
643
+ field_dict["array_job_id"] = array_job_id
644
+ if array_task_id is not UNSET:
645
+ field_dict["array_task_id"] = array_task_id
646
+ if attempt_id is not UNSET:
647
+ field_dict["attempt_id"] = attempt_id
648
+ if batch_features is not UNSET:
649
+ field_dict["batch_features"] = batch_features
650
+ if batch_host is not UNSET:
651
+ field_dict["batch_host"] = batch_host
652
+ if cluster is not UNSET:
653
+ field_dict["cluster"] = cluster
654
+ if cluster_id is not UNSET:
655
+ field_dict["cluster_id"] = cluster_id
656
+ if command is not UNSET:
657
+ field_dict["command"] = command
658
+ if comment is not UNSET:
659
+ field_dict["comment"] = comment
660
+ if completed_at is not UNSET:
661
+ field_dict["completed_at"] = completed_at
662
+ if cpus is not UNSET:
663
+ field_dict["cpus"] = cpus
664
+ if cpus_per_task is not UNSET:
665
+ field_dict["cpus_per_task"] = cpus_per_task
666
+ if created_at is not UNSET:
667
+ field_dict["created_at"] = created_at
668
+ if current_working_directory is not UNSET:
669
+ field_dict["current_working_directory"] = current_working_directory
670
+ if deadline is not UNSET:
671
+ field_dict["deadline"] = deadline
672
+ if eligible_at is not UNSET:
673
+ field_dict["eligible_at"] = eligible_at
674
+ if end_time is not UNSET:
675
+ field_dict["end_time"] = end_time
676
+ if exit_code is not UNSET:
677
+ field_dict["exit_code"] = exit_code
678
+ if flags is not UNSET:
679
+ field_dict["flags"] = flags
680
+ if gres_detail is not UNSET:
681
+ field_dict["gres_detail"] = gres_detail
682
+ if group_id is not UNSET:
683
+ field_dict["group_id"] = group_id
684
+ if group_name is not UNSET:
685
+ field_dict["group_name"] = group_name
686
+ if id is not UNSET:
687
+ field_dict["id"] = id
688
+ if job_id is not UNSET:
689
+ field_dict["job_id"] = job_id
690
+ if job_resources is not UNSET:
691
+ field_dict["job_resources"] = job_resources
692
+ if last_sched_evaluation_at is not UNSET:
693
+ field_dict["last_sched_evaluation_at"] = last_sched_evaluation_at
694
+ if memory is not UNSET:
695
+ field_dict["memory"] = memory
696
+ if minimum_cpus_per_node is not UNSET:
697
+ field_dict["minimum_cpus_per_node"] = minimum_cpus_per_node
698
+ if minimum_tmp_disk_per_node is not UNSET:
699
+ field_dict["minimum_tmp_disk_per_node"] = minimum_tmp_disk_per_node
700
+ if name is not UNSET:
701
+ field_dict["name"] = name
702
+ if node_count is not UNSET:
703
+ field_dict["node_count"] = node_count
704
+ if nodes is not UNSET:
705
+ field_dict["nodes"] = nodes
706
+ if partition is not UNSET:
707
+ field_dict["partition"] = partition
708
+ if pre_sus_time is not UNSET:
709
+ field_dict["pre_sus_time"] = pre_sus_time
710
+ if priority is not UNSET:
711
+ field_dict["priority"] = priority
712
+ if qos is not UNSET:
713
+ field_dict["qos"] = qos
714
+ if requeue is not UNSET:
715
+ field_dict["requeue"] = requeue
716
+ if resize_time is not UNSET:
717
+ field_dict["resize_time"] = resize_time
718
+ if resources is not UNSET:
719
+ field_dict["resources"] = resources
720
+ if restart_count is not UNSET:
721
+ field_dict["restart_count"] = restart_count
722
+ if script is not UNSET:
723
+ field_dict["script"] = script
724
+ if slurm_state is not UNSET:
725
+ field_dict["slurm_state"] = slurm_state
726
+ if standard_error is not UNSET:
727
+ field_dict["standard_error"] = standard_error
728
+ if standard_input is not UNSET:
729
+ field_dict["standard_input"] = standard_input
730
+ if standard_output is not UNSET:
731
+ field_dict["standard_output"] = standard_output
732
+ if started_at is not UNSET:
733
+ field_dict["started_at"] = started_at
734
+ if state_description is not UNSET:
735
+ field_dict["state_description"] = state_description
736
+ if state_reason is not UNSET:
737
+ field_dict["state_reason"] = state_reason
738
+ if status is not UNSET:
739
+ field_dict["status"] = status
740
+ if std_err is not UNSET:
741
+ field_dict["std_err"] = std_err
742
+ if std_in is not UNSET:
743
+ field_dict["std_in"] = std_in
744
+ if std_out is not UNSET:
745
+ field_dict["std_out"] = std_out
746
+ if submit_time is not UNSET:
747
+ field_dict["submit_time"] = submit_time
748
+ if submit_user_id is not UNSET:
749
+ field_dict["submit_user_id"] = submit_user_id
750
+ if submit_user_name is not UNSET:
751
+ field_dict["submit_user_name"] = submit_user_name
752
+ if suspend_time is not UNSET:
753
+ field_dict["suspend_time"] = suspend_time
754
+ if task_count is not UNSET:
755
+ field_dict["task_count"] = task_count
756
+ if task_id is not UNSET:
757
+ field_dict["task_id"] = task_id
758
+ if tasks is not UNSET:
759
+ field_dict["tasks"] = tasks
760
+ if team_id is not UNSET:
761
+ field_dict["team_id"] = team_id
762
+ if time_limit is not UNSET:
763
+ field_dict["time_limit"] = time_limit
764
+ if time_used is not UNSET:
765
+ field_dict["time_used"] = time_used
766
+ if tres is not UNSET:
767
+ field_dict["tres"] = tres
768
+ if tres_alloc_str is not UNSET:
769
+ field_dict["tres_alloc_str"] = tres_alloc_str
770
+ if tres_req_str is not UNSET:
771
+ field_dict["tres_req_str"] = tres_req_str
772
+ if tres_used is not UNSET:
773
+ field_dict["tres_used"] = tres_used
774
+ if updated_at is not UNSET:
775
+ field_dict["updated_at"] = updated_at
776
+ if user_id is not UNSET:
777
+ field_dict["user_id"] = user_id
778
+ if user_name is not UNSET:
779
+ field_dict["user_name"] = user_name
780
+ if work_dir is not UNSET:
781
+ field_dict["work_dir"] = work_dir
782
+
783
+ return field_dict
784
+
785
+ @classmethod
786
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
787
+ from ..models.task_alloc_tres_type_0 import TaskAllocTresType0
788
+ from ..models.task_gres_detail_type_0_item import TaskGresDetailType0Item
789
+ from ..models.task_job_resources_type_0 import TaskJobResourcesType0
790
+ from ..models.task_resources_type_0 import TaskResourcesType0
791
+ from ..models.task_tres_type_0 import TaskTresType0
792
+ from ..models.task_tres_used_type_0 import TaskTresUsedType0
793
+
794
+ d = dict(src_dict)
795
+
796
+ def _parse_account(data: object) -> Union[None, Unset, str]:
797
+ if data is None:
798
+ return data
799
+ if isinstance(data, Unset):
800
+ return data
801
+ return cast(Union[None, Unset, str], data)
802
+
803
+ account = _parse_account(d.pop("account", UNSET))
804
+
805
+ def _parse_alloc_tres(data: object) -> Union["TaskAllocTresType0", None, Unset]:
806
+ if data is None:
807
+ return data
808
+ if isinstance(data, Unset):
809
+ return data
810
+ try:
811
+ if not isinstance(data, dict):
812
+ raise TypeError()
813
+ alloc_tres_type_0 = TaskAllocTresType0.from_dict(data)
814
+
815
+ return alloc_tres_type_0
816
+ except: # noqa: E722
817
+ pass
818
+ return cast(Union["TaskAllocTresType0", None, Unset], data)
819
+
820
+ alloc_tres = _parse_alloc_tres(d.pop("alloc_tres", UNSET))
821
+
822
+ def _parse_array_job_id(data: object) -> Union[None, Unset, int]:
823
+ if data is None:
824
+ return data
825
+ if isinstance(data, Unset):
826
+ return data
827
+ return cast(Union[None, Unset, int], data)
828
+
829
+ array_job_id = _parse_array_job_id(d.pop("array_job_id", UNSET))
830
+
831
+ def _parse_array_task_id(data: object) -> Union[None, Unset, int]:
832
+ if data is None:
833
+ return data
834
+ if isinstance(data, Unset):
835
+ return data
836
+ return cast(Union[None, Unset, int], data)
837
+
838
+ array_task_id = _parse_array_task_id(d.pop("array_task_id", UNSET))
839
+
840
+ attempt_id = d.pop("attempt_id", UNSET)
841
+
842
+ def _parse_batch_features(data: object) -> Union[None, Unset, str]:
843
+ if data is None:
844
+ return data
845
+ if isinstance(data, Unset):
846
+ return data
847
+ return cast(Union[None, Unset, str], data)
848
+
849
+ batch_features = _parse_batch_features(d.pop("batch_features", UNSET))
850
+
851
+ def _parse_batch_host(data: object) -> Union[None, Unset, str]:
852
+ if data is None:
853
+ return data
854
+ if isinstance(data, Unset):
855
+ return data
856
+ return cast(Union[None, Unset, str], data)
857
+
858
+ batch_host = _parse_batch_host(d.pop("batch_host", UNSET))
859
+
860
+ def _parse_cluster(data: object) -> Union[None, Unset, str]:
861
+ if data is None:
862
+ return data
863
+ if isinstance(data, Unset):
864
+ return data
865
+ return cast(Union[None, Unset, str], data)
866
+
867
+ cluster = _parse_cluster(d.pop("cluster", UNSET))
868
+
869
+ def _parse_cluster_id(data: object) -> Union[None, Unset, int]:
870
+ if data is None:
871
+ return data
872
+ if isinstance(data, Unset):
873
+ return data
874
+ return cast(Union[None, Unset, int], data)
875
+
876
+ cluster_id = _parse_cluster_id(d.pop("cluster_id", UNSET))
877
+
878
+ def _parse_command(data: object) -> Union[None, Unset, str]:
879
+ if data is None:
880
+ return data
881
+ if isinstance(data, Unset):
882
+ return data
883
+ return cast(Union[None, Unset, str], data)
884
+
885
+ command = _parse_command(d.pop("command", UNSET))
886
+
887
+ def _parse_comment(data: object) -> Union[None, Unset, str]:
888
+ if data is None:
889
+ return data
890
+ if isinstance(data, Unset):
891
+ return data
892
+ return cast(Union[None, Unset, str], data)
893
+
894
+ comment = _parse_comment(d.pop("comment", UNSET))
895
+
896
+ def _parse_completed_at(data: object) -> Union[None, Unset, datetime.datetime]:
897
+ if data is None:
898
+ return data
899
+ if isinstance(data, Unset):
900
+ return data
901
+ try:
902
+ if not isinstance(data, str):
903
+ raise TypeError()
904
+ completed_at_type_0 = isoparse(data)
905
+
906
+ return completed_at_type_0
907
+ except: # noqa: E722
908
+ pass
909
+ return cast(Union[None, Unset, datetime.datetime], data)
910
+
911
+ completed_at = _parse_completed_at(d.pop("completed_at", UNSET))
912
+
913
+ def _parse_cpus(data: object) -> Union[None, Unset, int]:
914
+ if data is None:
915
+ return data
916
+ if isinstance(data, Unset):
917
+ return data
918
+ return cast(Union[None, Unset, int], data)
919
+
920
+ cpus = _parse_cpus(d.pop("cpus", UNSET))
921
+
922
+ def _parse_cpus_per_task(data: object) -> Union[None, Unset, int]:
923
+ if data is None:
924
+ return data
925
+ if isinstance(data, Unset):
926
+ return data
927
+ return cast(Union[None, Unset, int], data)
928
+
929
+ cpus_per_task = _parse_cpus_per_task(d.pop("cpus_per_task", UNSET))
930
+
931
+ _created_at = d.pop("created_at", UNSET)
932
+ created_at: Union[Unset, datetime.datetime]
933
+ if isinstance(_created_at, Unset):
934
+ created_at = UNSET
935
+ else:
936
+ created_at = isoparse(_created_at)
937
+
938
+ def _parse_current_working_directory(data: object) -> Union[None, Unset, str]:
939
+ if data is None:
940
+ return data
941
+ if isinstance(data, Unset):
942
+ return data
943
+ return cast(Union[None, Unset, str], data)
944
+
945
+ current_working_directory = _parse_current_working_directory(d.pop("current_working_directory", UNSET))
946
+
947
+ def _parse_deadline(data: object) -> Union[None, Unset, datetime.datetime]:
948
+ if data is None:
949
+ return data
950
+ if isinstance(data, Unset):
951
+ return data
952
+ try:
953
+ if not isinstance(data, str):
954
+ raise TypeError()
955
+ deadline_type_0 = isoparse(data)
956
+
957
+ return deadline_type_0
958
+ except: # noqa: E722
959
+ pass
960
+ return cast(Union[None, Unset, datetime.datetime], data)
961
+
962
+ deadline = _parse_deadline(d.pop("deadline", UNSET))
963
+
964
+ def _parse_eligible_at(data: object) -> Union[None, Unset, datetime.datetime]:
965
+ if data is None:
966
+ return data
967
+ if isinstance(data, Unset):
968
+ return data
969
+ try:
970
+ if not isinstance(data, str):
971
+ raise TypeError()
972
+ eligible_at_type_0 = isoparse(data)
973
+
974
+ return eligible_at_type_0
975
+ except: # noqa: E722
976
+ pass
977
+ return cast(Union[None, Unset, datetime.datetime], data)
978
+
979
+ eligible_at = _parse_eligible_at(d.pop("eligible_at", UNSET))
980
+
981
+ def _parse_end_time(data: object) -> Union[None, Unset, datetime.datetime]:
982
+ if data is None:
983
+ return data
984
+ if isinstance(data, Unset):
985
+ return data
986
+ try:
987
+ if not isinstance(data, str):
988
+ raise TypeError()
989
+ end_time_type_0 = isoparse(data)
990
+
991
+ return end_time_type_0
992
+ except: # noqa: E722
993
+ pass
994
+ return cast(Union[None, Unset, datetime.datetime], data)
995
+
996
+ end_time = _parse_end_time(d.pop("end_time", UNSET))
997
+
998
+ def _parse_exit_code(data: object) -> Union[None, Unset, int]:
999
+ if data is None:
1000
+ return data
1001
+ if isinstance(data, Unset):
1002
+ return data
1003
+ return cast(Union[None, Unset, int], data)
1004
+
1005
+ exit_code = _parse_exit_code(d.pop("exit_code", UNSET))
1006
+
1007
+ def _parse_flags(data: object) -> Union[None, Unset, list[str]]:
1008
+ if data is None:
1009
+ return data
1010
+ if isinstance(data, Unset):
1011
+ return data
1012
+ try:
1013
+ if not isinstance(data, list):
1014
+ raise TypeError()
1015
+ flags_type_0 = cast(list[str], data)
1016
+
1017
+ return flags_type_0
1018
+ except: # noqa: E722
1019
+ pass
1020
+ return cast(Union[None, Unset, list[str]], data)
1021
+
1022
+ flags = _parse_flags(d.pop("flags", UNSET))
1023
+
1024
+ def _parse_gres_detail(data: object) -> Union[None, Unset, list["TaskGresDetailType0Item"]]:
1025
+ if data is None:
1026
+ return data
1027
+ if isinstance(data, Unset):
1028
+ return data
1029
+ try:
1030
+ if not isinstance(data, list):
1031
+ raise TypeError()
1032
+ gres_detail_type_0 = []
1033
+ _gres_detail_type_0 = data
1034
+ for gres_detail_type_0_item_data in _gres_detail_type_0:
1035
+ gres_detail_type_0_item = TaskGresDetailType0Item.from_dict(gres_detail_type_0_item_data)
1036
+
1037
+ gres_detail_type_0.append(gres_detail_type_0_item)
1038
+
1039
+ return gres_detail_type_0
1040
+ except: # noqa: E722
1041
+ pass
1042
+ return cast(Union[None, Unset, list["TaskGresDetailType0Item"]], data)
1043
+
1044
+ gres_detail = _parse_gres_detail(d.pop("gres_detail", UNSET))
1045
+
1046
+ def _parse_group_id(data: object) -> Union[None, Unset, int]:
1047
+ if data is None:
1048
+ return data
1049
+ if isinstance(data, Unset):
1050
+ return data
1051
+ return cast(Union[None, Unset, int], data)
1052
+
1053
+ group_id = _parse_group_id(d.pop("group_id", UNSET))
1054
+
1055
+ def _parse_group_name(data: object) -> Union[None, Unset, str]:
1056
+ if data is None:
1057
+ return data
1058
+ if isinstance(data, Unset):
1059
+ return data
1060
+ return cast(Union[None, Unset, str], data)
1061
+
1062
+ group_name = _parse_group_name(d.pop("group_name", UNSET))
1063
+
1064
+ id = d.pop("id", UNSET)
1065
+
1066
+ job_id = d.pop("job_id", UNSET)
1067
+
1068
+ def _parse_job_resources(data: object) -> Union["TaskJobResourcesType0", None, Unset]:
1069
+ if data is None:
1070
+ return data
1071
+ if isinstance(data, Unset):
1072
+ return data
1073
+ try:
1074
+ if not isinstance(data, dict):
1075
+ raise TypeError()
1076
+ job_resources_type_0 = TaskJobResourcesType0.from_dict(data)
1077
+
1078
+ return job_resources_type_0
1079
+ except: # noqa: E722
1080
+ pass
1081
+ return cast(Union["TaskJobResourcesType0", None, Unset], data)
1082
+
1083
+ job_resources = _parse_job_resources(d.pop("job_resources", UNSET))
1084
+
1085
+ def _parse_last_sched_evaluation_at(data: object) -> Union[None, Unset, datetime.datetime]:
1086
+ if data is None:
1087
+ return data
1088
+ if isinstance(data, Unset):
1089
+ return data
1090
+ try:
1091
+ if not isinstance(data, str):
1092
+ raise TypeError()
1093
+ last_sched_evaluation_at_type_0 = isoparse(data)
1094
+
1095
+ return last_sched_evaluation_at_type_0
1096
+ except: # noqa: E722
1097
+ pass
1098
+ return cast(Union[None, Unset, datetime.datetime], data)
1099
+
1100
+ last_sched_evaluation_at = _parse_last_sched_evaluation_at(d.pop("last_sched_evaluation_at", UNSET))
1101
+
1102
+ def _parse_memory(data: object) -> Union[None, Unset, int]:
1103
+ if data is None:
1104
+ return data
1105
+ if isinstance(data, Unset):
1106
+ return data
1107
+ return cast(Union[None, Unset, int], data)
1108
+
1109
+ memory = _parse_memory(d.pop("memory", UNSET))
1110
+
1111
+ def _parse_minimum_cpus_per_node(data: object) -> Union[None, Unset, int]:
1112
+ if data is None:
1113
+ return data
1114
+ if isinstance(data, Unset):
1115
+ return data
1116
+ return cast(Union[None, Unset, int], data)
1117
+
1118
+ minimum_cpus_per_node = _parse_minimum_cpus_per_node(d.pop("minimum_cpus_per_node", UNSET))
1119
+
1120
+ def _parse_minimum_tmp_disk_per_node(data: object) -> Union[None, Unset, int]:
1121
+ if data is None:
1122
+ return data
1123
+ if isinstance(data, Unset):
1124
+ return data
1125
+ return cast(Union[None, Unset, int], data)
1126
+
1127
+ minimum_tmp_disk_per_node = _parse_minimum_tmp_disk_per_node(d.pop("minimum_tmp_disk_per_node", UNSET))
1128
+
1129
+ name = d.pop("name", UNSET)
1130
+
1131
+ def _parse_node_count(data: object) -> Union[None, Unset, int]:
1132
+ if data is None:
1133
+ return data
1134
+ if isinstance(data, Unset):
1135
+ return data
1136
+ return cast(Union[None, Unset, int], data)
1137
+
1138
+ node_count = _parse_node_count(d.pop("node_count", UNSET))
1139
+
1140
+ def _parse_nodes(data: object) -> Union[None, Unset, list[str]]:
1141
+ if data is None:
1142
+ return data
1143
+ if isinstance(data, Unset):
1144
+ return data
1145
+ try:
1146
+ if not isinstance(data, list):
1147
+ raise TypeError()
1148
+ nodes_type_0 = cast(list[str], data)
1149
+
1150
+ return nodes_type_0
1151
+ except: # noqa: E722
1152
+ pass
1153
+ return cast(Union[None, Unset, list[str]], data)
1154
+
1155
+ nodes = _parse_nodes(d.pop("nodes", UNSET))
1156
+
1157
+ def _parse_partition(data: object) -> Union[None, Unset, str]:
1158
+ if data is None:
1159
+ return data
1160
+ if isinstance(data, Unset):
1161
+ return data
1162
+ return cast(Union[None, Unset, str], data)
1163
+
1164
+ partition = _parse_partition(d.pop("partition", UNSET))
1165
+
1166
+ def _parse_pre_sus_time(data: object) -> Union[None, Unset, int]:
1167
+ if data is None:
1168
+ return data
1169
+ if isinstance(data, Unset):
1170
+ return data
1171
+ return cast(Union[None, Unset, int], data)
1172
+
1173
+ pre_sus_time = _parse_pre_sus_time(d.pop("pre_sus_time", UNSET))
1174
+
1175
+ def _parse_priority(data: object) -> Union[None, Unset, int]:
1176
+ if data is None:
1177
+ return data
1178
+ if isinstance(data, Unset):
1179
+ return data
1180
+ return cast(Union[None, Unset, int], data)
1181
+
1182
+ priority = _parse_priority(d.pop("priority", UNSET))
1183
+
1184
+ def _parse_qos(data: object) -> Union[None, Unset, str]:
1185
+ if data is None:
1186
+ return data
1187
+ if isinstance(data, Unset):
1188
+ return data
1189
+ return cast(Union[None, Unset, str], data)
1190
+
1191
+ qos = _parse_qos(d.pop("qos", UNSET))
1192
+
1193
+ def _parse_requeue(data: object) -> Union[None, Unset, bool]:
1194
+ if data is None:
1195
+ return data
1196
+ if isinstance(data, Unset):
1197
+ return data
1198
+ return cast(Union[None, Unset, bool], data)
1199
+
1200
+ requeue = _parse_requeue(d.pop("requeue", UNSET))
1201
+
1202
+ def _parse_resize_time(data: object) -> Union[None, Unset, datetime.datetime]:
1203
+ if data is None:
1204
+ return data
1205
+ if isinstance(data, Unset):
1206
+ return data
1207
+ try:
1208
+ if not isinstance(data, str):
1209
+ raise TypeError()
1210
+ resize_time_type_0 = isoparse(data)
1211
+
1212
+ return resize_time_type_0
1213
+ except: # noqa: E722
1214
+ pass
1215
+ return cast(Union[None, Unset, datetime.datetime], data)
1216
+
1217
+ resize_time = _parse_resize_time(d.pop("resize_time", UNSET))
1218
+
1219
+ def _parse_resources(data: object) -> Union["TaskResourcesType0", None, Unset]:
1220
+ if data is None:
1221
+ return data
1222
+ if isinstance(data, Unset):
1223
+ return data
1224
+ try:
1225
+ if not isinstance(data, dict):
1226
+ raise TypeError()
1227
+ resources_type_0 = TaskResourcesType0.from_dict(data)
1228
+
1229
+ return resources_type_0
1230
+ except: # noqa: E722
1231
+ pass
1232
+ return cast(Union["TaskResourcesType0", None, Unset], data)
1233
+
1234
+ resources = _parse_resources(d.pop("resources", UNSET))
1235
+
1236
+ def _parse_restart_count(data: object) -> Union[None, Unset, int]:
1237
+ if data is None:
1238
+ return data
1239
+ if isinstance(data, Unset):
1240
+ return data
1241
+ return cast(Union[None, Unset, int], data)
1242
+
1243
+ restart_count = _parse_restart_count(d.pop("restart_count", UNSET))
1244
+
1245
+ def _parse_script(data: object) -> Union[None, Unset, str]:
1246
+ if data is None:
1247
+ return data
1248
+ if isinstance(data, Unset):
1249
+ return data
1250
+ return cast(Union[None, Unset, str], data)
1251
+
1252
+ script = _parse_script(d.pop("script", UNSET))
1253
+
1254
+ def _parse_slurm_state(data: object) -> Union[None, Unset, str]:
1255
+ if data is None:
1256
+ return data
1257
+ if isinstance(data, Unset):
1258
+ return data
1259
+ return cast(Union[None, Unset, str], data)
1260
+
1261
+ slurm_state = _parse_slurm_state(d.pop("slurm_state", UNSET))
1262
+
1263
+ def _parse_standard_error(data: object) -> Union[None, Unset, str]:
1264
+ if data is None:
1265
+ return data
1266
+ if isinstance(data, Unset):
1267
+ return data
1268
+ return cast(Union[None, Unset, str], data)
1269
+
1270
+ standard_error = _parse_standard_error(d.pop("standard_error", UNSET))
1271
+
1272
+ def _parse_standard_input(data: object) -> Union[None, Unset, str]:
1273
+ if data is None:
1274
+ return data
1275
+ if isinstance(data, Unset):
1276
+ return data
1277
+ return cast(Union[None, Unset, str], data)
1278
+
1279
+ standard_input = _parse_standard_input(d.pop("standard_input", UNSET))
1280
+
1281
+ def _parse_standard_output(data: object) -> Union[None, Unset, str]:
1282
+ if data is None:
1283
+ return data
1284
+ if isinstance(data, Unset):
1285
+ return data
1286
+ return cast(Union[None, Unset, str], data)
1287
+
1288
+ standard_output = _parse_standard_output(d.pop("standard_output", UNSET))
1289
+
1290
+ def _parse_started_at(data: object) -> Union[None, Unset, datetime.datetime]:
1291
+ if data is None:
1292
+ return data
1293
+ if isinstance(data, Unset):
1294
+ return data
1295
+ try:
1296
+ if not isinstance(data, str):
1297
+ raise TypeError()
1298
+ started_at_type_0 = isoparse(data)
1299
+
1300
+ return started_at_type_0
1301
+ except: # noqa: E722
1302
+ pass
1303
+ return cast(Union[None, Unset, datetime.datetime], data)
1304
+
1305
+ started_at = _parse_started_at(d.pop("started_at", UNSET))
1306
+
1307
+ def _parse_state_description(data: object) -> Union[None, Unset, str]:
1308
+ if data is None:
1309
+ return data
1310
+ if isinstance(data, Unset):
1311
+ return data
1312
+ return cast(Union[None, Unset, str], data)
1313
+
1314
+ state_description = _parse_state_description(d.pop("state_description", UNSET))
1315
+
1316
+ def _parse_state_reason(data: object) -> Union[None, Unset, str]:
1317
+ if data is None:
1318
+ return data
1319
+ if isinstance(data, Unset):
1320
+ return data
1321
+ return cast(Union[None, Unset, str], data)
1322
+
1323
+ state_reason = _parse_state_reason(d.pop("state_reason", UNSET))
1324
+
1325
+ _status = d.pop("status", UNSET)
1326
+ status: Union[Unset, TaskStatus]
1327
+ if isinstance(_status, Unset):
1328
+ status = UNSET
1329
+ else:
1330
+ status = TaskStatus(_status)
1331
+
1332
+ def _parse_std_err(data: object) -> Union[None, Unset, str]:
1333
+ if data is None:
1334
+ return data
1335
+ if isinstance(data, Unset):
1336
+ return data
1337
+ return cast(Union[None, Unset, str], data)
1338
+
1339
+ std_err = _parse_std_err(d.pop("std_err", UNSET))
1340
+
1341
+ def _parse_std_in(data: object) -> Union[None, Unset, str]:
1342
+ if data is None:
1343
+ return data
1344
+ if isinstance(data, Unset):
1345
+ return data
1346
+ return cast(Union[None, Unset, str], data)
1347
+
1348
+ std_in = _parse_std_in(d.pop("std_in", UNSET))
1349
+
1350
+ def _parse_std_out(data: object) -> Union[None, Unset, str]:
1351
+ if data is None:
1352
+ return data
1353
+ if isinstance(data, Unset):
1354
+ return data
1355
+ return cast(Union[None, Unset, str], data)
1356
+
1357
+ std_out = _parse_std_out(d.pop("std_out", UNSET))
1358
+
1359
+ def _parse_submit_time(data: object) -> Union[None, Unset, datetime.datetime]:
1360
+ if data is None:
1361
+ return data
1362
+ if isinstance(data, Unset):
1363
+ return data
1364
+ try:
1365
+ if not isinstance(data, str):
1366
+ raise TypeError()
1367
+ submit_time_type_0 = isoparse(data)
1368
+
1369
+ return submit_time_type_0
1370
+ except: # noqa: E722
1371
+ pass
1372
+ return cast(Union[None, Unset, datetime.datetime], data)
1373
+
1374
+ submit_time = _parse_submit_time(d.pop("submit_time", UNSET))
1375
+
1376
+ def _parse_submit_user_id(data: object) -> Union[None, Unset, int]:
1377
+ if data is None:
1378
+ return data
1379
+ if isinstance(data, Unset):
1380
+ return data
1381
+ return cast(Union[None, Unset, int], data)
1382
+
1383
+ submit_user_id = _parse_submit_user_id(d.pop("submit_user_id", UNSET))
1384
+
1385
+ def _parse_submit_user_name(data: object) -> Union[None, Unset, str]:
1386
+ if data is None:
1387
+ return data
1388
+ if isinstance(data, Unset):
1389
+ return data
1390
+ return cast(Union[None, Unset, str], data)
1391
+
1392
+ submit_user_name = _parse_submit_user_name(d.pop("submit_user_name", UNSET))
1393
+
1394
+ def _parse_suspend_time(data: object) -> Union[None, Unset, datetime.datetime]:
1395
+ if data is None:
1396
+ return data
1397
+ if isinstance(data, Unset):
1398
+ return data
1399
+ try:
1400
+ if not isinstance(data, str):
1401
+ raise TypeError()
1402
+ suspend_time_type_0 = isoparse(data)
1403
+
1404
+ return suspend_time_type_0
1405
+ except: # noqa: E722
1406
+ pass
1407
+ return cast(Union[None, Unset, datetime.datetime], data)
1408
+
1409
+ suspend_time = _parse_suspend_time(d.pop("suspend_time", UNSET))
1410
+
1411
+ def _parse_task_count(data: object) -> Union[None, Unset, int]:
1412
+ if data is None:
1413
+ return data
1414
+ if isinstance(data, Unset):
1415
+ return data
1416
+ return cast(Union[None, Unset, int], data)
1417
+
1418
+ task_count = _parse_task_count(d.pop("task_count", UNSET))
1419
+
1420
+ task_id = d.pop("task_id", UNSET)
1421
+
1422
+ def _parse_tasks(data: object) -> Union[None, Unset, int]:
1423
+ if data is None:
1424
+ return data
1425
+ if isinstance(data, Unset):
1426
+ return data
1427
+ return cast(Union[None, Unset, int], data)
1428
+
1429
+ tasks = _parse_tasks(d.pop("tasks", UNSET))
1430
+
1431
+ def _parse_team_id(data: object) -> Union[None, Unset, int]:
1432
+ if data is None:
1433
+ return data
1434
+ if isinstance(data, Unset):
1435
+ return data
1436
+ return cast(Union[None, Unset, int], data)
1437
+
1438
+ team_id = _parse_team_id(d.pop("team_id", UNSET))
1439
+
1440
+ def _parse_time_limit(data: object) -> Union[None, Unset, int]:
1441
+ if data is None:
1442
+ return data
1443
+ if isinstance(data, Unset):
1444
+ return data
1445
+ return cast(Union[None, Unset, int], data)
1446
+
1447
+ time_limit = _parse_time_limit(d.pop("time_limit", UNSET))
1448
+
1449
+ def _parse_time_used(data: object) -> Union[None, Unset, int]:
1450
+ if data is None:
1451
+ return data
1452
+ if isinstance(data, Unset):
1453
+ return data
1454
+ return cast(Union[None, Unset, int], data)
1455
+
1456
+ time_used = _parse_time_used(d.pop("time_used", UNSET))
1457
+
1458
+ def _parse_tres(data: object) -> Union["TaskTresType0", None, Unset]:
1459
+ if data is None:
1460
+ return data
1461
+ if isinstance(data, Unset):
1462
+ return data
1463
+ try:
1464
+ if not isinstance(data, dict):
1465
+ raise TypeError()
1466
+ tres_type_0 = TaskTresType0.from_dict(data)
1467
+
1468
+ return tres_type_0
1469
+ except: # noqa: E722
1470
+ pass
1471
+ return cast(Union["TaskTresType0", None, Unset], data)
1472
+
1473
+ tres = _parse_tres(d.pop("tres", UNSET))
1474
+
1475
+ def _parse_tres_alloc_str(data: object) -> Union[None, Unset, str]:
1476
+ if data is None:
1477
+ return data
1478
+ if isinstance(data, Unset):
1479
+ return data
1480
+ return cast(Union[None, Unset, str], data)
1481
+
1482
+ tres_alloc_str = _parse_tres_alloc_str(d.pop("tres_alloc_str", UNSET))
1483
+
1484
+ def _parse_tres_req_str(data: object) -> Union[None, Unset, str]:
1485
+ if data is None:
1486
+ return data
1487
+ if isinstance(data, Unset):
1488
+ return data
1489
+ return cast(Union[None, Unset, str], data)
1490
+
1491
+ tres_req_str = _parse_tres_req_str(d.pop("tres_req_str", UNSET))
1492
+
1493
+ def _parse_tres_used(data: object) -> Union["TaskTresUsedType0", None, Unset]:
1494
+ if data is None:
1495
+ return data
1496
+ if isinstance(data, Unset):
1497
+ return data
1498
+ try:
1499
+ if not isinstance(data, dict):
1500
+ raise TypeError()
1501
+ tres_used_type_0 = TaskTresUsedType0.from_dict(data)
1502
+
1503
+ return tres_used_type_0
1504
+ except: # noqa: E722
1505
+ pass
1506
+ return cast(Union["TaskTresUsedType0", None, Unset], data)
1507
+
1508
+ tres_used = _parse_tres_used(d.pop("tres_used", UNSET))
1509
+
1510
+ _updated_at = d.pop("updated_at", UNSET)
1511
+ updated_at: Union[Unset, datetime.datetime]
1512
+ if isinstance(_updated_at, Unset):
1513
+ updated_at = UNSET
1514
+ else:
1515
+ updated_at = isoparse(_updated_at)
1516
+
1517
+ user_id = d.pop("user_id", UNSET)
1518
+
1519
+ def _parse_user_name(data: object) -> Union[None, Unset, str]:
1520
+ if data is None:
1521
+ return data
1522
+ if isinstance(data, Unset):
1523
+ return data
1524
+ return cast(Union[None, Unset, str], data)
1525
+
1526
+ user_name = _parse_user_name(d.pop("user_name", UNSET))
1527
+
1528
+ def _parse_work_dir(data: object) -> Union[None, Unset, str]:
1529
+ if data is None:
1530
+ return data
1531
+ if isinstance(data, Unset):
1532
+ return data
1533
+ return cast(Union[None, Unset, str], data)
1534
+
1535
+ work_dir = _parse_work_dir(d.pop("work_dir", UNSET))
1536
+
1537
+ task = cls(
1538
+ account=account,
1539
+ alloc_tres=alloc_tres,
1540
+ array_job_id=array_job_id,
1541
+ array_task_id=array_task_id,
1542
+ attempt_id=attempt_id,
1543
+ batch_features=batch_features,
1544
+ batch_host=batch_host,
1545
+ cluster=cluster,
1546
+ cluster_id=cluster_id,
1547
+ command=command,
1548
+ comment=comment,
1549
+ completed_at=completed_at,
1550
+ cpus=cpus,
1551
+ cpus_per_task=cpus_per_task,
1552
+ created_at=created_at,
1553
+ current_working_directory=current_working_directory,
1554
+ deadline=deadline,
1555
+ eligible_at=eligible_at,
1556
+ end_time=end_time,
1557
+ exit_code=exit_code,
1558
+ flags=flags,
1559
+ gres_detail=gres_detail,
1560
+ group_id=group_id,
1561
+ group_name=group_name,
1562
+ id=id,
1563
+ job_id=job_id,
1564
+ job_resources=job_resources,
1565
+ last_sched_evaluation_at=last_sched_evaluation_at,
1566
+ memory=memory,
1567
+ minimum_cpus_per_node=minimum_cpus_per_node,
1568
+ minimum_tmp_disk_per_node=minimum_tmp_disk_per_node,
1569
+ name=name,
1570
+ node_count=node_count,
1571
+ nodes=nodes,
1572
+ partition=partition,
1573
+ pre_sus_time=pre_sus_time,
1574
+ priority=priority,
1575
+ qos=qos,
1576
+ requeue=requeue,
1577
+ resize_time=resize_time,
1578
+ resources=resources,
1579
+ restart_count=restart_count,
1580
+ script=script,
1581
+ slurm_state=slurm_state,
1582
+ standard_error=standard_error,
1583
+ standard_input=standard_input,
1584
+ standard_output=standard_output,
1585
+ started_at=started_at,
1586
+ state_description=state_description,
1587
+ state_reason=state_reason,
1588
+ status=status,
1589
+ std_err=std_err,
1590
+ std_in=std_in,
1591
+ std_out=std_out,
1592
+ submit_time=submit_time,
1593
+ submit_user_id=submit_user_id,
1594
+ submit_user_name=submit_user_name,
1595
+ suspend_time=suspend_time,
1596
+ task_count=task_count,
1597
+ task_id=task_id,
1598
+ tasks=tasks,
1599
+ team_id=team_id,
1600
+ time_limit=time_limit,
1601
+ time_used=time_used,
1602
+ tres=tres,
1603
+ tres_alloc_str=tres_alloc_str,
1604
+ tres_req_str=tres_req_str,
1605
+ tres_used=tres_used,
1606
+ updated_at=updated_at,
1607
+ user_id=user_id,
1608
+ user_name=user_name,
1609
+ work_dir=work_dir,
1610
+ )
1611
+
1612
+ task.additional_properties = d
1613
+ return task
1614
+
1615
+ @property
1616
+ def additional_keys(self) -> list[str]:
1617
+ return list(self.additional_properties.keys())
1618
+
1619
+ def __getitem__(self, key: str) -> Any:
1620
+ return self.additional_properties[key]
1621
+
1622
+ def __setitem__(self, key: str, value: Any) -> None:
1623
+ self.additional_properties[key] = value
1624
+
1625
+ def __delitem__(self, key: str) -> None:
1626
+ del self.additional_properties[key]
1627
+
1628
+ def __contains__(self, key: str) -> bool:
1629
+ return key in self.additional_properties