client.task_resources ===================== .. py:module:: client.task_resources .. autoapi-nested-parse:: The client Task Resources with the resources initiation and binding to Task ID. Attributes ---------- .. autoapisummary:: client.task_resources.logger Classes ------- .. autoapisummary:: client.task_resources.TaskResources Module Contents --------------- .. py:data:: logger .. py:class:: TaskResources(requested_resources: Dict[str, Any], queue: jobmon.core.cluster_protocol.ClusterQueue, requester: Optional[jobmon.core.requester.Requester] = None) An object representing the resources for a specific task. Initialize the task resource object. .. py:attribute:: requested_resources .. py:attribute:: queue .. py:attribute:: requester :value: None .. py:property:: is_bound :type: bool If the TaskResources has been bound to the database. .. py:property:: id :type: int If the task resources has been bound to the database. .. py:method:: bind() -> None Bind TaskResources to the database (synchronous). .. py:method:: bind_async(session: aiohttp.ClientSession) -> None :async: Bind TaskResources to the database (asynchronous). :param session: An aiohttp ClientSession for making async HTTP requests. .. py:method:: validate_resources(strict: bool = False) -> Tuple[bool, str] .. py:method:: coerce_resources() -> TaskResources Coerce TaskResources to fit on queue. If resources change return a new object. .. py:method:: adjust_resources(resource_scales: Dict[str, Union[numbers.Number, Callable, Iterator[numbers.Number]]], fallback_queues: Optional[List[jobmon.core.cluster_protocol.ClusterQueue]] = None) -> TaskResources Adjust TaskResources after a resource error, returning a new object if it changed. :param resource_scales: Specifies how much to scale the failed Task's resources by. Scale factor can be a numeric value, a Callable that will be applied to the existing resources, or an Iterator. Any Callable should take a single numeric value as its sole argument. Any Iterator should only yield numeric values. Any Iterable can be easily converted to an Iterator by using the iter() built-in (e.g. iter([80, 160, 190])). :param fallback_queues: list of queues that users specify. If their jobs exceed the resources of a given queue, Jobmon will try to run their jobs on the fallback queues. .. py:method:: convert_memory_to_gib(memory_str: str) -> int :staticmethod: Given a memory request with a unit suffix, convert to GiB. .. py:method:: convert_runtime_to_s(time_str: Union[str, float, int]) -> int :staticmethod: Given a runtime request, coerce to seconds for recording in the DB. .. py:method:: scale_val(val: int, scaling_factor: float) -> float :staticmethod: Used ceil instead of round or floor, to handle case when resources is 1. For example, if runtime was 1, resource scales was 0.2. Then the resource would adjust to 1.2, which would be truncated to 1 again if using floor/round.