clarifai 11.3.0rc2__py3-none-any.whl → 11.4.0__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.
- clarifai/__init__.py +1 -1
- clarifai/cli/__main__.py +1 -1
- clarifai/cli/base.py +144 -136
- clarifai/cli/compute_cluster.py +45 -31
- clarifai/cli/deployment.py +93 -76
- clarifai/cli/model.py +578 -180
- clarifai/cli/nodepool.py +100 -82
- clarifai/client/__init__.py +12 -2
- clarifai/client/app.py +973 -911
- clarifai/client/auth/helper.py +345 -342
- clarifai/client/auth/register.py +7 -7
- clarifai/client/auth/stub.py +107 -106
- clarifai/client/base.py +185 -178
- clarifai/client/compute_cluster.py +214 -180
- clarifai/client/dataset.py +793 -698
- clarifai/client/deployment.py +55 -50
- clarifai/client/input.py +1223 -1088
- clarifai/client/lister.py +47 -45
- clarifai/client/model.py +1939 -1717
- clarifai/client/model_client.py +525 -502
- clarifai/client/module.py +82 -73
- clarifai/client/nodepool.py +358 -213
- clarifai/client/runner.py +58 -0
- clarifai/client/search.py +342 -309
- clarifai/client/user.py +419 -414
- clarifai/client/workflow.py +294 -274
- clarifai/constants/dataset.py +11 -17
- clarifai/constants/model.py +8 -2
- clarifai/datasets/export/inputs_annotations.py +233 -217
- clarifai/datasets/upload/base.py +63 -51
- clarifai/datasets/upload/features.py +43 -38
- clarifai/datasets/upload/image.py +237 -207
- clarifai/datasets/upload/loaders/coco_captions.py +34 -32
- clarifai/datasets/upload/loaders/coco_detection.py +72 -65
- clarifai/datasets/upload/loaders/imagenet_classification.py +57 -53
- clarifai/datasets/upload/loaders/xview_detection.py +274 -132
- clarifai/datasets/upload/multimodal.py +55 -46
- clarifai/datasets/upload/text.py +55 -47
- clarifai/datasets/upload/utils.py +250 -234
- clarifai/errors.py +51 -50
- clarifai/models/api.py +260 -238
- clarifai/modules/css.py +50 -50
- clarifai/modules/pages.py +33 -33
- clarifai/rag/rag.py +312 -288
- clarifai/rag/utils.py +91 -84
- clarifai/runners/models/model_builder.py +906 -802
- clarifai/runners/models/model_class.py +370 -331
- clarifai/runners/models/model_run_locally.py +459 -419
- clarifai/runners/models/model_runner.py +170 -162
- clarifai/runners/models/model_servicer.py +78 -70
- clarifai/runners/server.py +111 -101
- clarifai/runners/utils/code_script.py +225 -187
- clarifai/runners/utils/const.py +4 -1
- clarifai/runners/utils/data_types/__init__.py +12 -0
- clarifai/runners/utils/data_types/data_types.py +598 -0
- clarifai/runners/utils/data_utils.py +387 -440
- clarifai/runners/utils/loader.py +247 -227
- clarifai/runners/utils/method_signatures.py +411 -386
- clarifai/runners/utils/openai_convertor.py +108 -109
- clarifai/runners/utils/serializers.py +175 -179
- clarifai/runners/utils/url_fetcher.py +35 -35
- clarifai/schema/search.py +56 -63
- clarifai/urls/helper.py +125 -102
- clarifai/utils/cli.py +129 -123
- clarifai/utils/config.py +127 -87
- clarifai/utils/constants.py +49 -0
- clarifai/utils/evaluation/helpers.py +503 -466
- clarifai/utils/evaluation/main.py +431 -393
- clarifai/utils/evaluation/testset_annotation_parser.py +154 -144
- clarifai/utils/logging.py +324 -306
- clarifai/utils/misc.py +60 -56
- clarifai/utils/model_train.py +165 -146
- clarifai/utils/protobuf.py +126 -103
- clarifai/versions.py +3 -1
- clarifai/workflows/export.py +48 -50
- clarifai/workflows/utils.py +39 -36
- clarifai/workflows/validate.py +55 -43
- {clarifai-11.3.0rc2.dist-info → clarifai-11.4.0.dist-info}/METADATA +16 -6
- clarifai-11.4.0.dist-info/RECORD +109 -0
- {clarifai-11.3.0rc2.dist-info → clarifai-11.4.0.dist-info}/WHEEL +1 -1
- clarifai/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/__pycache__/errors.cpython-310.pyc +0 -0
- clarifai/__pycache__/errors.cpython-311.pyc +0 -0
- clarifai/__pycache__/versions.cpython-310.pyc +0 -0
- clarifai/__pycache__/versions.cpython-311.pyc +0 -0
- clarifai/cli/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/cli/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/cli/__pycache__/base.cpython-310.pyc +0 -0
- clarifai/cli/__pycache__/base.cpython-311.pyc +0 -0
- clarifai/cli/__pycache__/base_cli.cpython-310.pyc +0 -0
- clarifai/cli/__pycache__/compute_cluster.cpython-310.pyc +0 -0
- clarifai/cli/__pycache__/compute_cluster.cpython-311.pyc +0 -0
- clarifai/cli/__pycache__/deployment.cpython-310.pyc +0 -0
- clarifai/cli/__pycache__/deployment.cpython-311.pyc +0 -0
- clarifai/cli/__pycache__/model.cpython-310.pyc +0 -0
- clarifai/cli/__pycache__/model.cpython-311.pyc +0 -0
- clarifai/cli/__pycache__/model_cli.cpython-310.pyc +0 -0
- clarifai/cli/__pycache__/nodepool.cpython-310.pyc +0 -0
- clarifai/cli/__pycache__/nodepool.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/client/__pycache__/app.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/app.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/app.cpython-39.pyc +0 -0
- clarifai/client/__pycache__/base.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/base.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/compute_cluster.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/compute_cluster.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/dataset.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/dataset.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/deployment.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/deployment.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/input.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/input.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/lister.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/lister.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/model.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/model.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/module.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/module.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/nodepool.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/nodepool.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/search.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/search.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/user.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/user.cpython-311.pyc +0 -0
- clarifai/client/__pycache__/workflow.cpython-310.pyc +0 -0
- clarifai/client/__pycache__/workflow.cpython-311.pyc +0 -0
- clarifai/client/auth/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/client/auth/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/client/auth/__pycache__/helper.cpython-310.pyc +0 -0
- clarifai/client/auth/__pycache__/helper.cpython-311.pyc +0 -0
- clarifai/client/auth/__pycache__/register.cpython-310.pyc +0 -0
- clarifai/client/auth/__pycache__/register.cpython-311.pyc +0 -0
- clarifai/client/auth/__pycache__/stub.cpython-310.pyc +0 -0
- clarifai/client/auth/__pycache__/stub.cpython-311.pyc +0 -0
- clarifai/client/cli/__init__.py +0 -0
- clarifai/client/cli/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/client/cli/__pycache__/base_cli.cpython-310.pyc +0 -0
- clarifai/client/cli/__pycache__/model_cli.cpython-310.pyc +0 -0
- clarifai/client/cli/base_cli.py +0 -88
- clarifai/client/cli/model_cli.py +0 -29
- clarifai/constants/__pycache__/base.cpython-310.pyc +0 -0
- clarifai/constants/__pycache__/base.cpython-311.pyc +0 -0
- clarifai/constants/__pycache__/dataset.cpython-310.pyc +0 -0
- clarifai/constants/__pycache__/dataset.cpython-311.pyc +0 -0
- clarifai/constants/__pycache__/input.cpython-310.pyc +0 -0
- clarifai/constants/__pycache__/input.cpython-311.pyc +0 -0
- clarifai/constants/__pycache__/model.cpython-310.pyc +0 -0
- clarifai/constants/__pycache__/model.cpython-311.pyc +0 -0
- clarifai/constants/__pycache__/rag.cpython-310.pyc +0 -0
- clarifai/constants/__pycache__/rag.cpython-311.pyc +0 -0
- clarifai/constants/__pycache__/search.cpython-310.pyc +0 -0
- clarifai/constants/__pycache__/search.cpython-311.pyc +0 -0
- clarifai/constants/__pycache__/workflow.cpython-310.pyc +0 -0
- clarifai/constants/__pycache__/workflow.cpython-311.pyc +0 -0
- clarifai/datasets/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/datasets/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/datasets/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/datasets/export/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/datasets/export/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/datasets/export/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/datasets/export/__pycache__/inputs_annotations.cpython-310.pyc +0 -0
- clarifai/datasets/export/__pycache__/inputs_annotations.cpython-311.pyc +0 -0
- clarifai/datasets/upload/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/datasets/upload/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/datasets/upload/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/datasets/upload/__pycache__/base.cpython-310.pyc +0 -0
- clarifai/datasets/upload/__pycache__/base.cpython-311.pyc +0 -0
- clarifai/datasets/upload/__pycache__/features.cpython-310.pyc +0 -0
- clarifai/datasets/upload/__pycache__/features.cpython-311.pyc +0 -0
- clarifai/datasets/upload/__pycache__/image.cpython-310.pyc +0 -0
- clarifai/datasets/upload/__pycache__/image.cpython-311.pyc +0 -0
- clarifai/datasets/upload/__pycache__/multimodal.cpython-310.pyc +0 -0
- clarifai/datasets/upload/__pycache__/multimodal.cpython-311.pyc +0 -0
- clarifai/datasets/upload/__pycache__/text.cpython-310.pyc +0 -0
- clarifai/datasets/upload/__pycache__/text.cpython-311.pyc +0 -0
- clarifai/datasets/upload/__pycache__/utils.cpython-310.pyc +0 -0
- clarifai/datasets/upload/__pycache__/utils.cpython-311.pyc +0 -0
- clarifai/datasets/upload/loaders/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/datasets/upload/loaders/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/datasets/upload/loaders/__pycache__/coco_detection.cpython-311.pyc +0 -0
- clarifai/datasets/upload/loaders/__pycache__/imagenet_classification.cpython-311.pyc +0 -0
- clarifai/models/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/modules/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/rag/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/rag/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/rag/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/rag/__pycache__/rag.cpython-310.pyc +0 -0
- clarifai/rag/__pycache__/rag.cpython-311.pyc +0 -0
- clarifai/rag/__pycache__/rag.cpython-39.pyc +0 -0
- clarifai/rag/__pycache__/utils.cpython-310.pyc +0 -0
- clarifai/rag/__pycache__/utils.cpython-311.pyc +0 -0
- clarifai/runners/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/runners/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/runners/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/runners/dockerfile_template/Dockerfile.cpu.template +0 -31
- clarifai/runners/dockerfile_template/Dockerfile.cuda.template +0 -42
- clarifai/runners/dockerfile_template/Dockerfile.nim +0 -71
- clarifai/runners/models/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/runners/models/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/runners/models/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/runners/models/__pycache__/base_typed_model.cpython-310.pyc +0 -0
- clarifai/runners/models/__pycache__/base_typed_model.cpython-311.pyc +0 -0
- clarifai/runners/models/__pycache__/base_typed_model.cpython-39.pyc +0 -0
- clarifai/runners/models/__pycache__/model_builder.cpython-311.pyc +0 -0
- clarifai/runners/models/__pycache__/model_class.cpython-310.pyc +0 -0
- clarifai/runners/models/__pycache__/model_class.cpython-311.pyc +0 -0
- clarifai/runners/models/__pycache__/model_run_locally.cpython-310-pytest-7.1.2.pyc +0 -0
- clarifai/runners/models/__pycache__/model_run_locally.cpython-310.pyc +0 -0
- clarifai/runners/models/__pycache__/model_run_locally.cpython-311.pyc +0 -0
- clarifai/runners/models/__pycache__/model_runner.cpython-310.pyc +0 -0
- clarifai/runners/models/__pycache__/model_runner.cpython-311.pyc +0 -0
- clarifai/runners/models/__pycache__/model_upload.cpython-310.pyc +0 -0
- clarifai/runners/models/base_typed_model.py +0 -238
- clarifai/runners/models/model_class_refract.py +0 -80
- clarifai/runners/models/model_upload.py +0 -607
- clarifai/runners/models/temp.py +0 -25
- clarifai/runners/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/runners/utils/__pycache__/__init__.cpython-38.pyc +0 -0
- clarifai/runners/utils/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/runners/utils/__pycache__/buffered_stream.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/buffered_stream.cpython-38.pyc +0 -0
- clarifai/runners/utils/__pycache__/buffered_stream.cpython-39.pyc +0 -0
- clarifai/runners/utils/__pycache__/const.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/const.cpython-311.pyc +0 -0
- clarifai/runners/utils/__pycache__/constants.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/constants.cpython-38.pyc +0 -0
- clarifai/runners/utils/__pycache__/constants.cpython-39.pyc +0 -0
- clarifai/runners/utils/__pycache__/data_handler.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/data_handler.cpython-311.pyc +0 -0
- clarifai/runners/utils/__pycache__/data_handler.cpython-38.pyc +0 -0
- clarifai/runners/utils/__pycache__/data_handler.cpython-39.pyc +0 -0
- clarifai/runners/utils/__pycache__/data_utils.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/data_utils.cpython-311.pyc +0 -0
- clarifai/runners/utils/__pycache__/data_utils.cpython-38.pyc +0 -0
- clarifai/runners/utils/__pycache__/data_utils.cpython-39.pyc +0 -0
- clarifai/runners/utils/__pycache__/grpc_server.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/grpc_server.cpython-38.pyc +0 -0
- clarifai/runners/utils/__pycache__/grpc_server.cpython-39.pyc +0 -0
- clarifai/runners/utils/__pycache__/health.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/health.cpython-38.pyc +0 -0
- clarifai/runners/utils/__pycache__/health.cpython-39.pyc +0 -0
- clarifai/runners/utils/__pycache__/loader.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/loader.cpython-311.pyc +0 -0
- clarifai/runners/utils/__pycache__/logging.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/logging.cpython-38.pyc +0 -0
- clarifai/runners/utils/__pycache__/logging.cpython-39.pyc +0 -0
- clarifai/runners/utils/__pycache__/stream_source.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/stream_source.cpython-39.pyc +0 -0
- clarifai/runners/utils/__pycache__/url_fetcher.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/url_fetcher.cpython-311.pyc +0 -0
- clarifai/runners/utils/__pycache__/url_fetcher.cpython-38.pyc +0 -0
- clarifai/runners/utils/__pycache__/url_fetcher.cpython-39.pyc +0 -0
- clarifai/runners/utils/data_handler.py +0 -231
- clarifai/runners/utils/data_handler_refract.py +0 -213
- clarifai/runners/utils/data_types.py +0 -469
- clarifai/runners/utils/logger.py +0 -0
- clarifai/runners/utils/openai_format.py +0 -87
- clarifai/schema/__pycache__/search.cpython-310.pyc +0 -0
- clarifai/schema/__pycache__/search.cpython-311.pyc +0 -0
- clarifai/urls/__pycache__/helper.cpython-310.pyc +0 -0
- clarifai/urls/__pycache__/helper.cpython-311.pyc +0 -0
- clarifai/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/utils/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/utils/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/utils/__pycache__/cli.cpython-310.pyc +0 -0
- clarifai/utils/__pycache__/cli.cpython-311.pyc +0 -0
- clarifai/utils/__pycache__/config.cpython-311.pyc +0 -0
- clarifai/utils/__pycache__/constants.cpython-310.pyc +0 -0
- clarifai/utils/__pycache__/constants.cpython-311.pyc +0 -0
- clarifai/utils/__pycache__/logging.cpython-310.pyc +0 -0
- clarifai/utils/__pycache__/logging.cpython-311.pyc +0 -0
- clarifai/utils/__pycache__/misc.cpython-310.pyc +0 -0
- clarifai/utils/__pycache__/misc.cpython-311.pyc +0 -0
- clarifai/utils/__pycache__/model_train.cpython-310.pyc +0 -0
- clarifai/utils/__pycache__/model_train.cpython-311.pyc +0 -0
- clarifai/utils/__pycache__/protobuf.cpython-311.pyc +0 -0
- clarifai/utils/evaluation/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/utils/evaluation/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/utils/evaluation/__pycache__/helpers.cpython-311.pyc +0 -0
- clarifai/utils/evaluation/__pycache__/main.cpython-311.pyc +0 -0
- clarifai/utils/evaluation/__pycache__/main.cpython-39.pyc +0 -0
- clarifai/workflows/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/workflows/__pycache__/__init__.cpython-311.pyc +0 -0
- clarifai/workflows/__pycache__/__init__.cpython-39.pyc +0 -0
- clarifai/workflows/__pycache__/export.cpython-310.pyc +0 -0
- clarifai/workflows/__pycache__/export.cpython-311.pyc +0 -0
- clarifai/workflows/__pycache__/utils.cpython-310.pyc +0 -0
- clarifai/workflows/__pycache__/utils.cpython-311.pyc +0 -0
- clarifai/workflows/__pycache__/validate.cpython-310.pyc +0 -0
- clarifai/workflows/__pycache__/validate.cpython-311.pyc +0 -0
- clarifai-11.3.0rc2.dist-info/RECORD +0 -322
- {clarifai-11.3.0rc2.dist-info → clarifai-11.4.0.dist-info}/entry_points.txt +0 -0
- {clarifai-11.3.0rc2.dist-info → clarifai-11.4.0.dist-info/licenses}/LICENSE +0 -0
- {clarifai-11.3.0rc2.dist-info → clarifai-11.4.0.dist-info}/top_level.txt +0 -0
clarifai/client/nodepool.py
CHANGED
@@ -9,222 +9,367 @@ from google.protobuf.json_format import MessageToDict
|
|
9
9
|
from clarifai.client.base import BaseClient
|
10
10
|
from clarifai.client.deployment import Deployment
|
11
11
|
from clarifai.client.lister import Lister
|
12
|
+
from clarifai.client.runner import Runner
|
12
13
|
from clarifai.errors import UserError
|
13
14
|
from clarifai.utils.logging import logger
|
14
15
|
|
15
16
|
|
16
17
|
class Nodepool(Lister, BaseClient):
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
18
|
+
"""Nodepool is a class that provides access to Clarifai API endpoints related to Nodepool information."""
|
19
|
+
|
20
|
+
def __init__(
|
21
|
+
self,
|
22
|
+
nodepool_id: str = None,
|
23
|
+
user_id: str = None,
|
24
|
+
base_url: str = "https://api.clarifai.com",
|
25
|
+
pat: str = None,
|
26
|
+
token: str = None,
|
27
|
+
root_certificates_path: str = None,
|
28
|
+
**kwargs,
|
29
|
+
):
|
30
|
+
"""Initializes a Nodepool object.
|
31
|
+
|
32
|
+
Args:
|
33
|
+
nodepool_id (str): The Nodepool ID for the Nodepool to interact with.
|
34
|
+
user_id (str): The user ID of the user.
|
35
|
+
base_url (str): Base API url. Default "https://api.clarifai.com"
|
36
|
+
pat (str): A personal access token for authentication. Can be set as env var CLARIFAI_PAT
|
37
|
+
token (str): A session token for authentication. Accepts either a session token or a pat. Can be set as env var CLARIFAI_SESSION_TOKEN
|
38
|
+
root_certificates_path (str): Path to the SSL root certificates file, used to establish secure gRPC connections.
|
39
|
+
**kwargs: Additional keyword arguments to be passed to the nodepool.
|
40
|
+
"""
|
41
|
+
self.kwargs = {**kwargs, 'id': nodepool_id}
|
42
|
+
self.nodepool_info = resources_pb2.Nodepool(**self.kwargs)
|
43
|
+
self.logger = logger
|
44
|
+
BaseClient.__init__(
|
45
|
+
self,
|
46
|
+
user_id=user_id,
|
47
|
+
base=base_url,
|
48
|
+
pat=pat,
|
49
|
+
token=token,
|
50
|
+
root_certificates_path=root_certificates_path,
|
51
|
+
)
|
52
|
+
Lister.__init__(self)
|
53
|
+
|
54
|
+
def list_deployments(
|
55
|
+
self, filter_by: Dict[str, Any] = {}, page_no: int = None, per_page: int = None
|
56
|
+
) -> Generator[Deployment, None, None]:
|
57
|
+
"""Lists all the available deployments of compute cluster.
|
58
|
+
|
59
|
+
Args:
|
60
|
+
filter_by (Dict[str, Any]): The filter to apply to the list of deployments.
|
61
|
+
page_no (int): The page number to list.
|
62
|
+
per_page (int): The number of items per page.
|
63
|
+
|
64
|
+
Yields:
|
65
|
+
Deployment: Deployment objects for the nodepools in the compute cluster.
|
66
|
+
|
67
|
+
Example:
|
68
|
+
>>> from clarifai.client.nodepool import Nodepool
|
69
|
+
>>> nodepool = Nodepool(nodepool_id="nodepool_id", user_id="user_id")
|
70
|
+
>>> all_deployments = list(nodepool.list_deployments())
|
71
|
+
|
72
|
+
Note:
|
73
|
+
Defaults to 16 per page if page_no is specified and per_page is not specified.
|
74
|
+
If both page_no and per_page are None, then lists all the resources.
|
75
|
+
"""
|
76
|
+
request_data = dict(user_app_id=self.user_app_id, nodepool_id=self.id, **filter_by)
|
77
|
+
all_deployments_info = self.list_pages_generator(
|
78
|
+
self.STUB.ListDeployments,
|
79
|
+
service_pb2.ListDeploymentsRequest,
|
80
|
+
request_data,
|
81
|
+
per_page=per_page,
|
82
|
+
page_no=page_no,
|
83
|
+
)
|
84
|
+
|
85
|
+
for deployment_info in all_deployments_info:
|
86
|
+
yield Deployment.from_auth_helper(auth=self.auth_helper, **deployment_info)
|
87
|
+
|
88
|
+
def _process_deployment_config(self, deployment_config: Dict[str, Any]) -> Dict[str, Any]:
|
89
|
+
assert "deployment" in deployment_config, "deployment info not found in the config file"
|
90
|
+
deployment = deployment_config['deployment']
|
91
|
+
assert ("worker" in deployment) and (
|
92
|
+
("model" in deployment["worker"]) or ("workflow" in deployment["worker"])
|
93
|
+
), "worker info not found in the config file"
|
94
|
+
assert "scheduling_choice" in deployment, "scheduling_choice not found in the config file"
|
95
|
+
assert "nodepools" in deployment, "nodepools not found in the config file"
|
96
|
+
deployment['user_id'] = self.user_app_id.user_id
|
97
|
+
if "autoscale_config" in deployment:
|
98
|
+
deployment['autoscale_config'] = resources_pb2.AutoscaleConfig(
|
99
|
+
**deployment['autoscale_config']
|
100
|
+
)
|
101
|
+
deployment['nodepools'] = [
|
102
|
+
resources_pb2.Nodepool(
|
103
|
+
id=nodepool['id'],
|
104
|
+
compute_cluster=resources_pb2.ComputeCluster(
|
105
|
+
id=nodepool['compute_cluster']['id'], user_id=self.user_app_id.user_id
|
106
|
+
),
|
107
|
+
)
|
108
|
+
for nodepool in deployment['nodepools']
|
109
|
+
]
|
110
|
+
if 'user' in deployment['worker']:
|
111
|
+
deployment['worker']['user'] = resources_pb2.User(**deployment['worker']['user'])
|
112
|
+
elif 'model' in deployment['worker']:
|
113
|
+
deployment['worker']['model'] = resources_pb2.Model(**deployment['worker']['model'])
|
114
|
+
elif 'workflow' in deployment['worker']:
|
115
|
+
deployment['worker']['workflow'] = resources_pb2.Workflow(
|
116
|
+
**deployment['worker']['workflow']
|
117
|
+
)
|
118
|
+
deployment['worker'] = resources_pb2.Worker(**deployment['worker'])
|
119
|
+
if "visibility" in deployment:
|
120
|
+
deployment["visibility"] = resources_pb2.Visibility(**deployment["visibility"])
|
121
|
+
return deployment
|
122
|
+
|
123
|
+
@staticmethod
|
124
|
+
def get_runner_selector(
|
125
|
+
user_id: str, compute_cluster_id: str, nodepool_id: str
|
126
|
+
) -> resources_pb2.RunnerSelector:
|
127
|
+
"""Returns a RunnerSelector object for the specified compute cluster and nodepool.
|
128
|
+
|
129
|
+
Args:
|
130
|
+
user_id (str): The user ID of the user.
|
131
|
+
compute_cluster_id (str): The compute cluster ID for the compute cluster.
|
132
|
+
nodepool_id (str): The nodepool ID for the nodepool.
|
133
|
+
|
134
|
+
Returns:
|
135
|
+
resources_pb2.RunnerSelector: A RunnerSelector object for the specified compute cluster and nodepool.
|
136
|
+
|
137
|
+
Example:
|
138
|
+
>>> from clarifai.client.nodepool import Nodepool
|
139
|
+
>>> nodepool = Nodepool(nodepool_id="nodepool_id", user_id="user_id")
|
140
|
+
>>> runner_selector = Nodepool.get_runner_selector(user_id="user_id", compute_cluster_id="compute_cluster_id", nodepool_id="nodepool_id")
|
141
|
+
"""
|
142
|
+
compute_cluster = resources_pb2.ComputeCluster(id=compute_cluster_id, user_id=user_id)
|
143
|
+
nodepool = resources_pb2.Nodepool(id=nodepool_id, compute_cluster=compute_cluster)
|
144
|
+
return resources_pb2.RunnerSelector(nodepool=nodepool)
|
145
|
+
|
146
|
+
def create_deployment(
|
42
147
|
self,
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
("
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
**
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
148
|
+
config_filepath: str = None,
|
149
|
+
deployment_id: str = None,
|
150
|
+
deployment_config: Dict[str, Any] = None,
|
151
|
+
) -> Deployment:
|
152
|
+
"""Creates a deployment for the nodepool.
|
153
|
+
|
154
|
+
Args:
|
155
|
+
config_filepath (str): The path to the deployment config file.
|
156
|
+
deployment_id (str): New deployment ID for the deployment to create.
|
157
|
+
|
158
|
+
Returns:
|
159
|
+
Deployment: A Deployment object for the specified deployment ID.
|
160
|
+
|
161
|
+
Example:
|
162
|
+
>>> from clarifai.client.nodepool import Nodepool
|
163
|
+
>>> nodepool = Nodepool(nodepool_id="nodepool_id", user_id="user_id")
|
164
|
+
>>> deployment = nodepool.create_deployment(config_filepath="config.yml")
|
165
|
+
"""
|
166
|
+
|
167
|
+
if config_filepath is not None:
|
168
|
+
assert deployment_config is None, (
|
169
|
+
"deployment_config has to be None if config_filepath is provided"
|
170
|
+
)
|
171
|
+
|
172
|
+
if not os.path.exists(config_filepath):
|
173
|
+
raise UserError(f"Deployment config file not found at {config_filepath}")
|
174
|
+
with open(config_filepath, "r") as file:
|
175
|
+
deployment_config = yaml.safe_load(file)
|
176
|
+
elif deployment_config is not None:
|
177
|
+
assert isinstance(deployment_config, dict), (
|
178
|
+
"deployment_config should be a dictionary if provided."
|
179
|
+
)
|
180
|
+
else:
|
181
|
+
raise AssertionError("Either config_filepath or deployment_config must be provided.")
|
182
|
+
|
183
|
+
deployment_config = self._process_deployment_config(deployment_config)
|
184
|
+
|
185
|
+
if 'id' in deployment_config:
|
186
|
+
if deployment_id is None:
|
187
|
+
deployment_id = deployment_config['id']
|
188
|
+
deployment_config.pop('id')
|
189
|
+
|
190
|
+
request = service_pb2.PostDeploymentsRequest(
|
191
|
+
user_app_id=self.user_app_id,
|
192
|
+
deployments=[resources_pb2.Deployment(id=deployment_id, **deployment_config)],
|
193
|
+
)
|
194
|
+
response = self._grpc_request(self.STUB.PostDeployments, request)
|
195
|
+
if response.status.code != status_code_pb2.SUCCESS:
|
196
|
+
raise Exception(response.status)
|
197
|
+
self.logger.info("\nDeployment created\n%s", response.status)
|
198
|
+
|
199
|
+
dict_response = MessageToDict(
|
200
|
+
response.deployments[0], preserving_proto_field_name=True, use_integers_for_enums=True
|
201
|
+
)
|
202
|
+
kwargs = self.process_response_keys(dict_response, "deployment")
|
203
|
+
return Deployment.from_auth_helper(auth=self.auth_helper, **kwargs)
|
204
|
+
|
205
|
+
def deployment(self, deployment_id: str) -> Deployment:
|
206
|
+
"""Returns a Deployment object for the existing deployment ID.
|
207
|
+
|
208
|
+
Args:
|
209
|
+
deployment_id (str): The deployment ID for the deployment to interact with.
|
210
|
+
|
211
|
+
Returns:
|
212
|
+
Deployment: A Deployment object for the existing deployment ID.
|
213
|
+
|
214
|
+
Example:
|
215
|
+
>>> from clarifai.client.nodepool import Nodepool
|
216
|
+
>>> nodepool = Nodepool(nodepool_id="nodepool_id", user_id="user_id")
|
217
|
+
>>> deployment = nodepool.deployment(deployment_id="deployment_id")
|
218
|
+
"""
|
219
|
+
request = service_pb2.GetDeploymentRequest(
|
220
|
+
user_app_id=self.user_app_id, deployment_id=deployment_id
|
221
|
+
)
|
222
|
+
response = self._grpc_request(self.STUB.GetDeployment, request)
|
223
|
+
|
224
|
+
if response.status.code != status_code_pb2.SUCCESS:
|
225
|
+
raise Exception(response.status)
|
226
|
+
dict_response = MessageToDict(
|
227
|
+
response, preserving_proto_field_name=True, use_integers_for_enums=True
|
228
|
+
)
|
229
|
+
kwargs = self.process_response_keys(dict_response["deployment"], "deployment")
|
230
|
+
return Deployment.from_auth_helper(auth=self.auth_helper, **kwargs)
|
231
|
+
|
232
|
+
def delete_deployments(self, deployment_ids: List[str]) -> None:
|
233
|
+
"""Deletes list of deployments for the nodepool.
|
234
|
+
|
235
|
+
Args:
|
236
|
+
deployment_ids (List[str]): The list of deployment IDs to delete.
|
237
|
+
|
238
|
+
Example:
|
239
|
+
>>> from clarifai.client.nodepool import Nodepool
|
240
|
+
>>> nodepool = Nodepool(nodepool_id="nodepool_id", user_id="user_id")
|
241
|
+
>>> nodepool.delete_deployments(deployment_ids=["deployment_id1", "deployment_id2"])
|
242
|
+
"""
|
243
|
+
assert isinstance(deployment_ids, list), "deployment_ids param should be a list"
|
244
|
+
|
245
|
+
request = service_pb2.DeleteDeploymentsRequest(
|
246
|
+
user_app_id=self.user_app_id, ids=deployment_ids
|
247
|
+
)
|
248
|
+
response = self._grpc_request(self.STUB.DeleteDeployments, request)
|
249
|
+
|
250
|
+
if response.status.code != status_code_pb2.SUCCESS:
|
251
|
+
raise Exception(response.status)
|
252
|
+
self.logger.info("\nDeployments Deleted\n%s", response.status)
|
253
|
+
|
254
|
+
def runner(self, runner_id: str) -> Runner:
|
255
|
+
"""Returns a Runner object for the existing runner ID.
|
256
|
+
|
257
|
+
Args:
|
258
|
+
runner_id (str): The runner ID for the runner to interact with.
|
259
|
+
|
260
|
+
Returns:
|
261
|
+
Runner: A Runner object for the existing runner ID.
|
262
|
+
|
263
|
+
Example:
|
264
|
+
>>> from clarifai.client.nodepool import Nodepool
|
265
|
+
>>> nodepool = Nodepool(nodepool_id="nodepool_id", user_id="user_id")
|
266
|
+
>>> runner = nodepool.runner(runner_id="runner_id")
|
267
|
+
"""
|
268
|
+
request = service_pb2.GetRunnerRequest(user_app_id=self.user_app_id, runner_id=runner_id)
|
269
|
+
response = self._grpc_request(self.STUB.GetRunner, request)
|
270
|
+
|
271
|
+
if response.status.code != status_code_pb2.SUCCESS:
|
272
|
+
raise Exception(response.status)
|
273
|
+
dict_response = MessageToDict(
|
274
|
+
response, preserving_proto_field_name=True, use_integers_for_enums=True
|
275
|
+
)
|
276
|
+
kwargs = self.process_response_keys(dict_response["runner"], "runner")
|
277
|
+
return Runner.from_auth_helper(auth=self.auth_helper, **kwargs)
|
278
|
+
|
279
|
+
def create_runner(
|
280
|
+
self, config_filepath: str = None, runner_config: Dict[str, Any] = None
|
281
|
+
) -> Runner:
|
282
|
+
"""Creates a runner for the nodepool. Only needed for local dev runners.
|
283
|
+
|
284
|
+
Args:
|
285
|
+
config_filepath (str): The path to the runner config file.
|
286
|
+
nodepool_config (Dict[str, Any]) = nodepool_config or {}
|
287
|
+
|
288
|
+
Returns:
|
289
|
+
resources_pb2.Runner: A Runner object for the specified deployment ID.
|
290
|
+
|
291
|
+
Example:
|
292
|
+
>>> from clarifai.client.nodepool import Nodepool
|
293
|
+
>>> nodepool = Nodepool(nodepool_id="nodepool_id", user_id="user_id")
|
294
|
+
>>> runner = nodepool.create_runner(deployment_id="deployment_id")
|
295
|
+
"""
|
296
|
+
|
297
|
+
if config_filepath is not None:
|
298
|
+
assert runner_config is None, (
|
299
|
+
"runner_config has to be None if config_filepath is provided"
|
300
|
+
)
|
301
|
+
|
302
|
+
if not os.path.exists(config_filepath):
|
303
|
+
raise UserError(f"Runner config file not found at {config_filepath}")
|
304
|
+
with open(config_filepath, "r") as file:
|
305
|
+
runner_config = yaml.safe_load(file)
|
306
|
+
elif runner_config is not None:
|
307
|
+
assert isinstance(runner_config, dict), (
|
308
|
+
"runner_config should be a dictionary if provided."
|
309
|
+
)
|
310
|
+
else:
|
311
|
+
raise AssertionError("Either config_filepath or runner_config must be provided.")
|
312
|
+
|
313
|
+
runner_config = self._process_runner_config(runner_config)
|
314
|
+
|
315
|
+
request = service_pb2.PostRunnersRequest(
|
316
|
+
user_app_id=self.user_app_id,
|
317
|
+
nodepool_id=self.id,
|
318
|
+
compute_cluster_id=self.compute_cluster.id,
|
319
|
+
runners=[resources_pb2.Runner(**runner_config)],
|
320
|
+
)
|
321
|
+
response = self._grpc_request(self.STUB.PostRunners, request)
|
322
|
+
|
323
|
+
if response.status.code != status_code_pb2.SUCCESS:
|
324
|
+
raise Exception(response.status)
|
325
|
+
self.logger.info(
|
326
|
+
"\nRunner created\n%s with id: %s", response.status, response.runners[0].id
|
327
|
+
)
|
328
|
+
|
329
|
+
dict_response = MessageToDict(response.runners[0], preserving_proto_field_name=True)
|
330
|
+
kwargs = self.process_response_keys(dict_response, 'runner')
|
331
|
+
return Runner.from_auth_helper(auth=self.auth_helper, **kwargs)
|
332
|
+
|
333
|
+
def delete_runners(self, runner_ids: List[str]) -> None:
|
334
|
+
"""Deletes list of runners for the nodepool.
|
335
|
+
|
336
|
+
Args:
|
337
|
+
runner_ids (List[str]): The list of runner IDs to delete.
|
338
|
+
|
339
|
+
Example:
|
340
|
+
>>> from clarifai.client.nodepool import Nodepool
|
341
|
+
>>> nodepool = Nodepool(nodepool_id="nodepool_id", user_id="user_id")
|
342
|
+
>>> nodepool.delete_runners(runner_ids=["runner_id1", "runner_id2"])
|
343
|
+
"""
|
344
|
+
assert isinstance(runner_ids, list), "runner_ids param should be a list"
|
345
|
+
|
346
|
+
request = service_pb2.DeleteRunnersRequest(
|
347
|
+
user_app_id=self.user_app_id,
|
348
|
+
ids=runner_ids,
|
349
|
+
compute_cluster_id=self.compute_cluster.id,
|
350
|
+
nodepool_id=self.id,
|
351
|
+
)
|
352
|
+
response = self._grpc_request(self.STUB.DeleteRunners, request)
|
353
|
+
|
354
|
+
if response.status.code != status_code_pb2.SUCCESS:
|
355
|
+
raise Exception(response.status)
|
356
|
+
self.logger.info("\nRunners Deleted\n%s", response.status)
|
357
|
+
|
358
|
+
def _process_runner_config(self, runner_config: str) -> Dict[str, Any]:
|
359
|
+
assert "runner" in runner_config, "runner info not found in the config file"
|
360
|
+
runner = runner_config['runner']
|
361
|
+
assert "worker" in runner, "worker not found in the config file"
|
362
|
+
assert "num_replicas" in runner, "num_replicas not found in the config file"
|
363
|
+
return runner
|
364
|
+
|
365
|
+
def __getattr__(self, name):
|
366
|
+
return getattr(self.nodepool_info, name)
|
367
|
+
|
368
|
+
def __str__(self):
|
369
|
+
init_params = [param for param in self.kwargs.keys()]
|
370
|
+
attribute_strings = [
|
371
|
+
f"{param}={getattr(self.nodepool_info, param)}"
|
372
|
+
for param in init_params
|
373
|
+
if hasattr(self.nodepool_info, param)
|
374
|
+
]
|
375
|
+
return f"Nodepool Details: \n{', '.join(attribute_strings)}\n"
|
@@ -0,0 +1,58 @@
|
|
1
|
+
from clarifai_grpc.grpc.api import resources_pb2
|
2
|
+
|
3
|
+
from clarifai.client.base import BaseClient
|
4
|
+
from clarifai.client.lister import Lister
|
5
|
+
from clarifai.utils.logging import logger
|
6
|
+
from clarifai.utils.protobuf import dict_to_protobuf
|
7
|
+
|
8
|
+
|
9
|
+
class Runner(Lister, BaseClient):
|
10
|
+
"""Runner is a class that provides access to Clarifai API endpoints related to Runner information."""
|
11
|
+
|
12
|
+
def __init__(
|
13
|
+
self,
|
14
|
+
runner_id: str = None,
|
15
|
+
user_id: str = None,
|
16
|
+
base_url: str = "https://api.clarifai.com",
|
17
|
+
pat: str = None,
|
18
|
+
token: str = None,
|
19
|
+
root_certificates_path: str = None,
|
20
|
+
**kwargs,
|
21
|
+
):
|
22
|
+
"""Initializes a Runner object.
|
23
|
+
|
24
|
+
Args:
|
25
|
+
runner_id (str): The Runner ID for the Runner to interact with.
|
26
|
+
user_id (str): The user ID of the user.
|
27
|
+
base_url (str): Base API url. Default "https://api.clarifai.com"
|
28
|
+
pat (str): A personal access token for authentication. Can be set as env var CLARIFAI_PAT
|
29
|
+
token (str): A session token for authentication. Accepts either a session token or a pat. Can be set as env var CLARIFAI_SESSION_TOKEN
|
30
|
+
root_certificates_path (str): Path to the SSL root certificates file, used to establish secure gRPC connections.
|
31
|
+
**kwargs: Additional keyword arguments to be passed to the runner.
|
32
|
+
"""
|
33
|
+
self.kwargs = {**kwargs, 'id': runner_id}
|
34
|
+
self.runner_info = resources_pb2.Runner()
|
35
|
+
dict_to_protobuf(self.runner_info, self.kwargs)
|
36
|
+
|
37
|
+
self.logger = logger
|
38
|
+
BaseClient.__init__(
|
39
|
+
self,
|
40
|
+
user_id=user_id,
|
41
|
+
base=base_url,
|
42
|
+
pat=pat,
|
43
|
+
token=token,
|
44
|
+
root_certificates_path=root_certificates_path,
|
45
|
+
)
|
46
|
+
Lister.__init__(self)
|
47
|
+
|
48
|
+
def __getattr__(self, name):
|
49
|
+
return getattr(self.runner_info, name)
|
50
|
+
|
51
|
+
def __str__(self):
|
52
|
+
init_params = [param for param in self.kwargs.keys()]
|
53
|
+
attribute_strings = [
|
54
|
+
f"{param}={getattr(self.runner_info, param)}"
|
55
|
+
for param in init_params
|
56
|
+
if hasattr(self.runner_info, param)
|
57
|
+
]
|
58
|
+
return f"Runner Details: \n{', '.join(attribute_strings)}\n"
|