Skip to content

Commit 837134e

Browse files
feat: Pilots and Users are splitted for jobs
1 parent f17e4db commit 837134e

File tree

16 files changed

+223
-797
lines changed

16 files changed

+223
-797
lines changed

diracx-client/src/diracx/client/_generated/aio/operations/_operations.py

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
build_auth_revoke_refresh_token_by_refresh_token_request,
3939
build_auth_userinfo_request,
4040
build_config_serve_config_request,
41-
build_jobs_add_heartbeat_request,
4241
build_jobs_assign_sandbox_to_job_request,
4342
build_jobs_get_job_sandbox_request,
4443
build_jobs_get_job_sandboxes_request,
@@ -1580,123 +1579,6 @@ async def set_job_statuses(
15801579

15811580
return deserialized # type: ignore
15821581

1583-
@overload
1584-
async def add_heartbeat(
1585-
self, body: Dict[str, _models.HeartbeatData], *, content_type: str = "application/json", **kwargs: Any
1586-
) -> List[_models.JobCommand]:
1587-
"""Add Heartbeat.
1588-
1589-
Register a heartbeat from the job.
1590-
1591-
This endpoint is used by the JobAgent to send heartbeats to the WMS and to
1592-
receive job commands from the WMS. It also results in stalled jobs being
1593-
restored to the RUNNING status.
1594-
1595-
The ``data`` parameter and return value are mappings keyed by job ID.
1596-
1597-
:param body: Required.
1598-
:type body: dict[str, ~_generated.models.HeartbeatData]
1599-
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1600-
Default value is "application/json".
1601-
:paramtype content_type: str
1602-
:return: list of JobCommand
1603-
:rtype: list[~_generated.models.JobCommand]
1604-
:raises ~azure.core.exceptions.HttpResponseError:
1605-
"""
1606-
1607-
@overload
1608-
async def add_heartbeat(
1609-
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1610-
) -> List[_models.JobCommand]:
1611-
"""Add Heartbeat.
1612-
1613-
Register a heartbeat from the job.
1614-
1615-
This endpoint is used by the JobAgent to send heartbeats to the WMS and to
1616-
receive job commands from the WMS. It also results in stalled jobs being
1617-
restored to the RUNNING status.
1618-
1619-
The ``data`` parameter and return value are mappings keyed by job ID.
1620-
1621-
:param body: Required.
1622-
:type body: IO[bytes]
1623-
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1624-
Default value is "application/json".
1625-
:paramtype content_type: str
1626-
:return: list of JobCommand
1627-
:rtype: list[~_generated.models.JobCommand]
1628-
:raises ~azure.core.exceptions.HttpResponseError:
1629-
"""
1630-
1631-
@distributed_trace_async
1632-
async def add_heartbeat(
1633-
self, body: Union[Dict[str, _models.HeartbeatData], IO[bytes]], **kwargs: Any
1634-
) -> List[_models.JobCommand]:
1635-
"""Add Heartbeat.
1636-
1637-
Register a heartbeat from the job.
1638-
1639-
This endpoint is used by the JobAgent to send heartbeats to the WMS and to
1640-
receive job commands from the WMS. It also results in stalled jobs being
1641-
restored to the RUNNING status.
1642-
1643-
The ``data`` parameter and return value are mappings keyed by job ID.
1644-
1645-
:param body: Is either a {str: HeartbeatData} type or a IO[bytes] type. Required.
1646-
:type body: dict[str, ~_generated.models.HeartbeatData] or IO[bytes]
1647-
:return: list of JobCommand
1648-
:rtype: list[~_generated.models.JobCommand]
1649-
:raises ~azure.core.exceptions.HttpResponseError:
1650-
"""
1651-
error_map: MutableMapping = {
1652-
401: ClientAuthenticationError,
1653-
404: ResourceNotFoundError,
1654-
409: ResourceExistsError,
1655-
304: ResourceNotModifiedError,
1656-
}
1657-
error_map.update(kwargs.pop("error_map", {}) or {})
1658-
1659-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1660-
_params = kwargs.pop("params", {}) or {}
1661-
1662-
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1663-
cls: ClsType[List[_models.JobCommand]] = kwargs.pop("cls", None)
1664-
1665-
content_type = content_type or "application/json"
1666-
_json = None
1667-
_content = None
1668-
if isinstance(body, (IOBase, bytes)):
1669-
_content = body
1670-
else:
1671-
_json = self._serialize.body(body, "{HeartbeatData}")
1672-
1673-
_request = build_jobs_add_heartbeat_request(
1674-
content_type=content_type,
1675-
json=_json,
1676-
content=_content,
1677-
headers=_headers,
1678-
params=_params,
1679-
)
1680-
_request.url = self._client.format_url(_request.url)
1681-
1682-
_stream = False
1683-
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
1684-
_request, stream=_stream, **kwargs
1685-
)
1686-
1687-
response = pipeline_response.http_response
1688-
1689-
if response.status_code not in [200]:
1690-
map_error(status_code=response.status_code, response=response, error_map=error_map)
1691-
raise HttpResponseError(response=response)
1692-
1693-
deserialized = self._deserialize("[JobCommand]", pipeline_response.http_response)
1694-
1695-
if cls:
1696-
return cls(pipeline_response, deserialized, {}) # type: ignore
1697-
1698-
return deserialized # type: ignore
1699-
17001582
@distributed_trace_async
17011583
async def reschedule_jobs(self, *, job_ids: List[int], reset_jobs: bool = False, **kwargs: Any) -> Dict[str, Any]:
17021584
"""Reschedule Jobs.

diracx-client/src/diracx/client/_generated/models/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@
2222
BodyPilotsRefreshPilotTokens,
2323
GroupInfo,
2424
HTTPValidationError,
25-
HeartbeatData,
2625
InitiateDeviceFlowResponse,
2726
InsertedJob,
28-
JobCommand,
2927
JobStatusUpdate,
3028
JobSummaryParams,
3129
JobSummaryParamsSearchItem,
@@ -82,10 +80,8 @@
8280
"BodyPilotsRefreshPilotTokens",
8381
"GroupInfo",
8482
"HTTPValidationError",
85-
"HeartbeatData",
8683
"InitiateDeviceFlowResponse",
8784
"InsertedJob",
88-
"JobCommand",
8985
"JobStatusUpdate",
9086
"JobSummaryParams",
9187
"JobSummaryParamsSearchItem",

diracx-client/src/diracx/client/_generated/models/_models.py

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -355,73 +355,6 @@ def __init__(self, *, properties: List[str], **kwargs: Any) -> None:
355355
self.properties = properties
356356

357357

358-
class HeartbeatData(_serialization.Model):
359-
"""HeartbeatData.
360-
361-
:ivar load_average: Loadaverage.
362-
:vartype load_average: float
363-
:ivar memory_used: Memoryused.
364-
:vartype memory_used: float
365-
:ivar vsize: Vsize.
366-
:vartype vsize: float
367-
:ivar available_disk_space: Availablediskspace.
368-
:vartype available_disk_space: float
369-
:ivar cpu_consumed: Cpuconsumed.
370-
:vartype cpu_consumed: float
371-
:ivar wall_clock_time: Wallclocktime.
372-
:vartype wall_clock_time: float
373-
:ivar standard_output: Standardoutput.
374-
:vartype standard_output: str
375-
"""
376-
377-
_attribute_map = {
378-
"load_average": {"key": "LoadAverage", "type": "float"},
379-
"memory_used": {"key": "MemoryUsed", "type": "float"},
380-
"vsize": {"key": "Vsize", "type": "float"},
381-
"available_disk_space": {"key": "AvailableDiskSpace", "type": "float"},
382-
"cpu_consumed": {"key": "CPUConsumed", "type": "float"},
383-
"wall_clock_time": {"key": "WallClockTime", "type": "float"},
384-
"standard_output": {"key": "StandardOutput", "type": "str"},
385-
}
386-
387-
def __init__(
388-
self,
389-
*,
390-
load_average: Optional[float] = None,
391-
memory_used: Optional[float] = None,
392-
vsize: Optional[float] = None,
393-
available_disk_space: Optional[float] = None,
394-
cpu_consumed: Optional[float] = None,
395-
wall_clock_time: Optional[float] = None,
396-
standard_output: Optional[str] = None,
397-
**kwargs: Any
398-
) -> None:
399-
"""
400-
:keyword load_average: Loadaverage.
401-
:paramtype load_average: float
402-
:keyword memory_used: Memoryused.
403-
:paramtype memory_used: float
404-
:keyword vsize: Vsize.
405-
:paramtype vsize: float
406-
:keyword available_disk_space: Availablediskspace.
407-
:paramtype available_disk_space: float
408-
:keyword cpu_consumed: Cpuconsumed.
409-
:paramtype cpu_consumed: float
410-
:keyword wall_clock_time: Wallclocktime.
411-
:paramtype wall_clock_time: float
412-
:keyword standard_output: Standardoutput.
413-
:paramtype standard_output: str
414-
"""
415-
super().__init__(**kwargs)
416-
self.load_average = load_average
417-
self.memory_used = memory_used
418-
self.vsize = vsize
419-
self.available_disk_space = available_disk_space
420-
self.cpu_consumed = cpu_consumed
421-
self.wall_clock_time = wall_clock_time
422-
self.standard_output = standard_output
423-
424-
425358
class HTTPValidationError(_serialization.Model):
426359
"""HTTPValidationError.
427360
@@ -554,45 +487,6 @@ def __init__(
554487
self.time_stamp = time_stamp
555488

556489

557-
class JobCommand(_serialization.Model):
558-
"""JobCommand.
559-
560-
All required parameters must be populated in order to send to server.
561-
562-
:ivar job_id: Job Id. Required.
563-
:vartype job_id: int
564-
:ivar command: Command. Required.
565-
:vartype command: str
566-
:ivar arguments: Arguments.
567-
:vartype arguments: str
568-
"""
569-
570-
_validation = {
571-
"job_id": {"required": True},
572-
"command": {"required": True},
573-
}
574-
575-
_attribute_map = {
576-
"job_id": {"key": "job_id", "type": "int"},
577-
"command": {"key": "command", "type": "str"},
578-
"arguments": {"key": "arguments", "type": "str"},
579-
}
580-
581-
def __init__(self, *, job_id: int, command: str, arguments: Optional[str] = None, **kwargs: Any) -> None:
582-
"""
583-
:keyword job_id: Job Id. Required.
584-
:paramtype job_id: int
585-
:keyword command: Command. Required.
586-
:paramtype command: str
587-
:keyword arguments: Arguments.
588-
:paramtype arguments: str
589-
"""
590-
super().__init__(**kwargs)
591-
self.job_id = job_id
592-
self.command = command
593-
self.arguments = arguments
594-
595-
596490
class JobStatusUpdate(_serialization.Model):
597491
"""JobStatusUpdate.
598492

0 commit comments

Comments
 (0)