Skip to content

WorkerVersion

arkindex_worker.worker.version

ElementsWorker methods for worker versions.

Classes

WorkerVersionMixin

Functions
get_worker_version
get_worker_version(worker_version_id: str) -> dict
Warns:

This method is deprecated.

Retrieve a worker version, using the ElementsWorker’s internal cache when possible.

Parameters:

Name Type Description Default
worker_version_id str

ID of the worker version to retrieve.

required

Returns:

Type Description
dict

The requested worker version, as returned by the RetrieveWorkerVersion API endpoint.

Source code in arkindex_worker/worker/version.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@worker_version_deprecation
def get_worker_version(self, worker_version_id: str) -> dict:
    """
    Warns:
    ----
    This method is **deprecated**.

    Retrieve a worker version, using the [ElementsWorker][arkindex_worker.worker.ElementsWorker]'s internal cache when possible.

    :param worker_version_id: ID of the worker version to retrieve.
    :returns: The requested worker version, as returned by the ``RetrieveWorkerVersion`` API endpoint.
    """
    if worker_version_id is None:
        raise ValueError("No worker version ID")

    if worker_version_id in self._worker_version_cache:
        return self._worker_version_cache[worker_version_id]

    worker_version = self.api_client.request(
        "RetrieveWorkerVersion", id=worker_version_id
    )
    self._worker_version_cache[worker_version_id] = worker_version

    return worker_version
get_worker_version_slug
get_worker_version_slug(worker_version_id: str) -> str
Warns:

This method is deprecated.

Retrieve the slug of the worker of a worker version, from a worker version UUID. Uses a worker version from the internal cache if possible, otherwise makes an API request.

Parameters:

Name Type Description Default
worker_version_id str

ID of the worker version to find a slug for.

required

Returns:

Type Description
str

Slug of the worker of this worker version.

Source code in arkindex_worker/worker/version.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@worker_version_deprecation
def get_worker_version_slug(self, worker_version_id: str) -> str:
    """
    Warns:
    ----
    This method is **deprecated**.

    Retrieve the slug of the worker of a worker version, from a worker version UUID.
    Uses a worker version from the internal cache if possible, otherwise makes an API request.

    :param worker_version_id: ID of the worker version to find a slug for.
    :returns: Slug of the worker of this worker version.
    """
    worker_version = self.get_worker_version(worker_version_id)
    return worker_version["worker"]["slug"]