qwak-sdk 0.5.66__py3-none-any.whl → 0.5.71__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.
Potentially problematic release.
This version of qwak-sdk might be problematic. Click here for more details.
- qwak_sdk/__init__.py +1 -1
- qwak_sdk/commands/models/build/_logic/wait_until_finished.py +27 -0
- qwak_sdk/commands/models/build/ui.py +55 -18
- {qwak_sdk-0.5.66.dist-info → qwak_sdk-0.5.71.dist-info}/METADATA +3 -3
- {qwak_sdk-0.5.66.dist-info → qwak_sdk-0.5.71.dist-info}/RECORD +7 -6
- {qwak_sdk-0.5.66.dist-info → qwak_sdk-0.5.71.dist-info}/WHEEL +0 -0
- {qwak_sdk-0.5.66.dist-info → qwak_sdk-0.5.71.dist-info}/entry_points.txt +0 -0
qwak_sdk/__init__.py
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from logging import Logger
|
|
2
|
+
import time
|
|
3
|
+
from typing import List
|
|
4
|
+
from _qwak_proto.qwak.builds.builds_pb2 import BuildStatus
|
|
5
|
+
from qwak.clients.build_orchestrator import BuildOrchestratorClient
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def __get_current_status(build_id) -> BuildStatus:
|
|
9
|
+
return BuildOrchestratorClient().get_build(build_id).build.build_status
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def __end_state_statuses() -> List[BuildStatus.ValueType]:
|
|
13
|
+
return [BuildStatus.FAILED, BuildStatus.SUCCESSFUL, BuildStatus.REMOTE_BUILD_CANCELLED, BuildStatus.REMOTE_BUILD_TIMED_OUT]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def wait_until_finished(build_id, log: Logger, pool_interval_seconds=10) -> None:
|
|
17
|
+
status = __get_current_status(build_id)
|
|
18
|
+
log.info(f"Waiting for build {build_id} to finish. Aborting this process will not stop the build!")
|
|
19
|
+
log.debug(f"Current status of build {build_id}: {BuildStatus.DESCRIPTOR.values_by_number[status].name}")
|
|
20
|
+
while status not in __end_state_statuses():
|
|
21
|
+
time.sleep(pool_interval_seconds)
|
|
22
|
+
status = __get_current_status(build_id)
|
|
23
|
+
log.debug(f"Current status of build {build_id}: {BuildStatus.DESCRIPTOR.values_by_number[status].name}")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def is_final_status_successful(build_id) -> bool:
|
|
27
|
+
return __get_current_status(build_id) == BuildStatus.SUCCESSFUL
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import click
|
|
2
|
-
from qwak.inner.build_config.build_config_v1 import
|
|
3
|
-
BuildConfigV1
|
|
2
|
+
from qwak.inner.build_config.build_config_v1 import (
|
|
3
|
+
BuildConfigV1,
|
|
4
|
+
BuildProperties,
|
|
5
|
+
DockerConf,
|
|
6
|
+
ModelUri,
|
|
7
|
+
RemoteBuildResources,
|
|
8
|
+
)
|
|
4
9
|
from qwak.inner.build_logic.execute_build_pipeline import execute_build_pipeline
|
|
5
|
-
from qwak.inner.build_logic.run_handlers.programmatic_phase_run_handler import
|
|
10
|
+
from qwak.inner.build_logic.run_handlers.programmatic_phase_run_handler import (
|
|
11
|
+
ProgrammaticPhaseRunHandler,
|
|
12
|
+
)
|
|
6
13
|
from qwak.inner.const import QwakConstants
|
|
7
14
|
|
|
8
15
|
from qwak_sdk.commands.models.build._logic.build_steps import create_pipeline
|
|
9
|
-
from qwak_sdk.commands.models.build._logic.
|
|
16
|
+
from qwak_sdk.commands.models.build._logic.wait_until_finished import wait_until_finished, is_final_status_successful
|
|
17
|
+
from qwak_sdk.commands.models.build._logic.client_logs.cli_phase_run_handler import (
|
|
18
|
+
CLIPhaseRunHandler,
|
|
19
|
+
)
|
|
10
20
|
from qwak_sdk.commands.models.build._logic.client_logs.logger import get_build_logger
|
|
11
21
|
from qwak_sdk.commands.models.build._logic.client_logs.utils import zip_logs
|
|
12
22
|
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
@@ -14,7 +24,12 @@ from qwak_sdk.inner.tools.config_handler import config_handler
|
|
|
14
24
|
|
|
15
25
|
|
|
16
26
|
@click.command("build", cls=QwakCommand)
|
|
17
|
-
@click.option(
|
|
27
|
+
@click.option(
|
|
28
|
+
"--model-id",
|
|
29
|
+
metavar="NAME",
|
|
30
|
+
required=False,
|
|
31
|
+
help="Model ID to assign the build for",
|
|
32
|
+
)
|
|
18
33
|
@click.option(
|
|
19
34
|
"--main-dir",
|
|
20
35
|
metavar="NAME",
|
|
@@ -60,7 +75,7 @@ from qwak_sdk.inner.tools.config_handler import config_handler
|
|
|
60
75
|
"--git-credentials-secret",
|
|
61
76
|
metavar="NAME",
|
|
62
77
|
required=False,
|
|
63
|
-
help="
|
|
78
|
+
help="Predefined Qwak secret secret name, that contains access credentials to private repositories"
|
|
64
79
|
+ "Secrets should be of the form USERNAME:ACCESS_TOKEN. For info regarding defining Qwak Secrets using the"
|
|
65
80
|
+ "`qwak secret` command",
|
|
66
81
|
)
|
|
@@ -68,7 +83,7 @@ from qwak_sdk.inner.tools.config_handler import config_handler
|
|
|
68
83
|
"--cpus",
|
|
69
84
|
metavar="NAME",
|
|
70
85
|
required=False,
|
|
71
|
-
help="
|
|
86
|
+
help="Number of cpus to use on the remote build. [Default (If GPU not configured): 2] "
|
|
72
87
|
"(DO NOT CONFIGURE GPU AND CPU TOGETHER)",
|
|
73
88
|
type=click.FLOAT,
|
|
74
89
|
)
|
|
@@ -76,14 +91,14 @@ from qwak_sdk.inner.tools.config_handler import config_handler
|
|
|
76
91
|
"--memory",
|
|
77
92
|
metavar="NAME",
|
|
78
93
|
required=False,
|
|
79
|
-
help="
|
|
94
|
+
help="Memory to use on the remote build. [Default (If GPU not configured): 4Gi] "
|
|
80
95
|
"(DO NOT CONFIGURE GPU AND CPU TOGETHER)",
|
|
81
96
|
)
|
|
82
97
|
@click.option(
|
|
83
98
|
"--gpu-type",
|
|
84
99
|
metavar="NAME",
|
|
85
100
|
required=False,
|
|
86
|
-
help=f"
|
|
101
|
+
help=f"Type of GPU to use on the remote build ({', '.join([x for x in QwakConstants.GPU_TYPES])})."
|
|
87
102
|
f"\n[Default: {RemoteBuildResources.gpu_type}]"
|
|
88
103
|
"(DO NOT CONFIGURE GPU AND CPU TOGETHER)",
|
|
89
104
|
type=click.STRING,
|
|
@@ -93,13 +108,13 @@ from qwak_sdk.inner.tools.config_handler import config_handler
|
|
|
93
108
|
metavar="NAME",
|
|
94
109
|
required=False,
|
|
95
110
|
type=int,
|
|
96
|
-
help=f"
|
|
111
|
+
help=f"Amount of GPU's to use on the remote build."
|
|
97
112
|
f"\n[Default: {RemoteBuildResources.gpu_amount}] "
|
|
98
113
|
"(DO NOT CONFIGURE GPU AND CPU TOGETHER)",
|
|
99
114
|
)
|
|
100
115
|
@click.option(
|
|
101
116
|
"--gpu-compatible",
|
|
102
|
-
help=f"
|
|
117
|
+
help=f"Whether to build an image that is compatible to be deployd on a GPU instance."
|
|
103
118
|
f"\n[Default: {BuildProperties.gpu_compatible}] ",
|
|
104
119
|
default=False,
|
|
105
120
|
is_flag=True,
|
|
@@ -108,12 +123,12 @@ from qwak_sdk.inner.tools.config_handler import config_handler
|
|
|
108
123
|
"--iam-role-arn",
|
|
109
124
|
required=False,
|
|
110
125
|
type=str,
|
|
111
|
-
help="
|
|
126
|
+
help="Custom IAM Role ARN for AWS based builds",
|
|
112
127
|
)
|
|
113
128
|
@click.option(
|
|
114
129
|
"--service-account-key-secret-name",
|
|
115
130
|
type=str,
|
|
116
|
-
help="Custom service account for
|
|
131
|
+
help="Custom service account for GCP",
|
|
117
132
|
)
|
|
118
133
|
@click.option(
|
|
119
134
|
"--cache/--no-cache",
|
|
@@ -224,6 +239,12 @@ from qwak_sdk.inner.tools.config_handler import config_handler
|
|
|
224
239
|
default=False,
|
|
225
240
|
is_flag=True,
|
|
226
241
|
)
|
|
242
|
+
@click.option(
|
|
243
|
+
"--sync",
|
|
244
|
+
help="Waits until the build is finished (successfully or not) and return the build status",
|
|
245
|
+
default=False,
|
|
246
|
+
is_flag=True,
|
|
247
|
+
)
|
|
227
248
|
@click.option(
|
|
228
249
|
"--git-secret-ssh",
|
|
229
250
|
metavar="NAME",
|
|
@@ -234,10 +255,15 @@ from qwak_sdk.inner.tools.config_handler import config_handler
|
|
|
234
255
|
)
|
|
235
256
|
@click.option(
|
|
236
257
|
"--push/--no-push",
|
|
237
|
-
help="Whether to push the
|
|
258
|
+
help="Whether to push the build image to the registry (default is True)",
|
|
238
259
|
default=True,
|
|
239
260
|
is_flag=True,
|
|
240
261
|
)
|
|
262
|
+
@click.option(
|
|
263
|
+
"--provision-instance-timeout",
|
|
264
|
+
help="Timeout in minutes for the provision instance step",
|
|
265
|
+
default=120,
|
|
266
|
+
)
|
|
241
267
|
@click.argument("uri", required=False)
|
|
242
268
|
def models_build(**kwargs):
|
|
243
269
|
return build(**kwargs)
|
|
@@ -262,21 +288,32 @@ def build(
|
|
|
262
288
|
return
|
|
263
289
|
else:
|
|
264
290
|
id_only = kwargs.get("id_only")
|
|
291
|
+
is_sync = kwargs.get("sync")
|
|
265
292
|
pipeline, success_msg = create_pipeline(config)
|
|
266
293
|
with get_build_logger(config=config, json_logs=json_logs) as (
|
|
267
|
-
|
|
268
|
-
|
|
294
|
+
logger,
|
|
295
|
+
log_path,
|
|
269
296
|
):
|
|
270
297
|
if programmatic:
|
|
271
|
-
build_runner = ProgrammaticPhaseRunHandler(
|
|
298
|
+
build_runner = ProgrammaticPhaseRunHandler(
|
|
299
|
+
logger, config.verbose, json_logs
|
|
300
|
+
)
|
|
272
301
|
else:
|
|
273
|
-
build_runner = CLIPhaseRunHandler(
|
|
302
|
+
build_runner = CLIPhaseRunHandler(
|
|
303
|
+
logger, log_path, config.verbose, json_logs
|
|
304
|
+
)
|
|
274
305
|
|
|
275
306
|
execute_build_pipeline(
|
|
276
307
|
pipeline,
|
|
277
308
|
build_runner,
|
|
278
309
|
)
|
|
279
310
|
|
|
311
|
+
if is_sync:
|
|
312
|
+
wait_until_finished(pipeline.context.build_id, logger)
|
|
313
|
+
if not is_final_status_successful(pipeline.context.build_id):
|
|
314
|
+
click.echo(f"Build {pipeline.context.build_id} failed")
|
|
315
|
+
exit(1)
|
|
316
|
+
|
|
280
317
|
if id_only:
|
|
281
318
|
print(pipeline.context.build_id)
|
|
282
319
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: qwak-sdk
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.71
|
|
4
4
|
Summary: Qwak SDK and CLI for qwak models
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Keywords: mlops,ml,deployment,serving,model
|
|
@@ -37,8 +37,8 @@ Requires-Dist: pandas (>1.1.3) ; (python_version >= "3.9" and python_version < "
|
|
|
37
37
|
Requires-Dist: pandas (>=1.4.0) ; (python_version >= "3.10" and python_version < "3.12") and (extra == "batch" or extra == "feedback")
|
|
38
38
|
Requires-Dist: pyarrow (>=6.0.0,<11.0.0) ; extra == "batch"
|
|
39
39
|
Requires-Dist: python-json-logger (>=2.0.2)
|
|
40
|
-
Requires-Dist: qwak-core (==0.
|
|
41
|
-
Requires-Dist: qwak-inference (>=0.1.
|
|
40
|
+
Requires-Dist: qwak-core (==0.4.30)
|
|
41
|
+
Requires-Dist: qwak-inference (>=0.1.16,<0.2.0)
|
|
42
42
|
Requires-Dist: rich (>=13.0.0)
|
|
43
43
|
Requires-Dist: tabulate (>=0.8.0)
|
|
44
44
|
Requires-Dist: yaspin (>=2.0.0)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
qwak_sdk/__init__.py,sha256=
|
|
1
|
+
qwak_sdk/__init__.py,sha256=eYBmalUF336OGeZ6M7C74pQyrqHlexzGhyCoNNJy-Iw,135
|
|
2
2
|
qwak_sdk/cli.py,sha256=FIK1dUNxR57ypb-CeD7fKSJnPJ02lrjR9G4aj2qMLPU,2458
|
|
3
3
|
qwak_sdk/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
qwak_sdk/commands/_logic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -121,7 +121,8 @@ qwak_sdk/commands/models/build/_logic/util/__init__.py,sha256=47DEQpj8HBSa-_TImW
|
|
|
121
121
|
qwak_sdk/commands/models/build/_logic/util/protobuf_factory.py,sha256=ar_oY38w_x0sxgVF7EBs5h7gchNsDntvtKK5sSYxb24,1686
|
|
122
122
|
qwak_sdk/commands/models/build/_logic/util/step_decorator.py,sha256=HLZyCGdqe3Ir7SaPWp1YNRHJpjXG-e-bbAvnOFysAVM,1913
|
|
123
123
|
qwak_sdk/commands/models/build/_logic/util/text.py,sha256=tH-v19Mt8l90sMVxku5XRtrderT0qdRqJ-jLijqannA,188
|
|
124
|
-
qwak_sdk/commands/models/build/
|
|
124
|
+
qwak_sdk/commands/models/build/_logic/wait_until_finished.py,sha256=DxIyNK-MFjxSh9xe7dJx-znmz8ZOqelK-cJQvr7YI9g,1220
|
|
125
|
+
qwak_sdk/commands/models/build/ui.py,sha256=ZfOFzZxMT3bSUz42dn9LF7Pept9Ed9afWu0-_0HES_w,9761
|
|
125
126
|
qwak_sdk/commands/models/builds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
126
127
|
qwak_sdk/commands/models/builds/builds_commands_group.py,sha256=0nSfTY8TracXG61rFboQWUTXJisHO6dgtJKeijy6ru8,491
|
|
127
128
|
qwak_sdk/commands/models/builds/cancel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -318,7 +319,7 @@ qwak_sdk/tools/colors.py,sha256=7pui_GGjC4uZKYFsIyXaJjYsjLxJVHb4OrfTgr93hqo,287
|
|
|
318
319
|
qwak_sdk/tools/files.py,sha256=AyKJTOy7NhvP3SrqwIw_lxYNCOy1CvLgMmSJpWZ0OKM,2257
|
|
319
320
|
qwak_sdk/tools/log_handling.py,sha256=Aa1EmxUPCX8YWiZRutUvnqPv6K_z1zoGMwIWsEv24mM,6327
|
|
320
321
|
qwak_sdk/tools/utils.py,sha256=SHmU4r_m2ABZyFYMC03P17GvltPbYbmB39hvalIZEtI,1168
|
|
321
|
-
qwak_sdk-0.5.
|
|
322
|
-
qwak_sdk-0.5.
|
|
323
|
-
qwak_sdk-0.5.
|
|
324
|
-
qwak_sdk-0.5.
|
|
322
|
+
qwak_sdk-0.5.71.dist-info/entry_points.txt,sha256=vSl0ELYDyj640oMM57u0AjBP87wtLYxCcGOendhEx80,47
|
|
323
|
+
qwak_sdk-0.5.71.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
|
|
324
|
+
qwak_sdk-0.5.71.dist-info/METADATA,sha256=Uz78vRZFsUPsiURuIRINNI-mpzgt3PbDrM-WSw7umaE,2600
|
|
325
|
+
qwak_sdk-0.5.71.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|