polyaxon 2.0.0rc49__py3-none-any.whl → 2.4.0rc1__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.
- polyaxon/_auxiliaries/cleaner.py +8 -3
- polyaxon/_auxiliaries/init.py +7 -2
- polyaxon/_auxiliaries/notifier.py +8 -2
- polyaxon/_auxiliaries/sidecar.py +30 -2
- polyaxon/_cli/artifacts.py +96 -11
- polyaxon/_cli/components.py +96 -11
- polyaxon/_cli/config.py +118 -22
- polyaxon/_cli/dashboard.py +15 -2
- polyaxon/_cli/init.py +1 -1
- polyaxon/_cli/models.py +96 -11
- polyaxon/_cli/operations.py +267 -90
- polyaxon/_cli/project_versions.py +139 -6
- polyaxon/_cli/projects.py +23 -9
- polyaxon/_cli/run.py +37 -9
- polyaxon/_cli/services/agent.py +2 -2
- polyaxon/_cli/services/clean_artifacts.py +1 -1
- polyaxon/_cli/services/sidecar.py +8 -1
- polyaxon/_client/client.py +17 -0
- polyaxon/_client/mixin.py +39 -0
- polyaxon/_client/project.py +218 -23
- polyaxon/_client/run.py +131 -33
- polyaxon/_compiler/contexts/contexts.py +2 -2
- polyaxon/_compiler/contexts/ray_job.py +4 -2
- polyaxon/_compiler/resolver/agent.py +12 -2
- polyaxon/_compiler/resolver/runtime.py +2 -2
- polyaxon/_contexts/paths.py +4 -7
- polyaxon/_deploy/operators/compose.py +1 -27
- polyaxon/_deploy/schemas/deployment.py +4 -1
- polyaxon/_deploy/schemas/intervals.py +0 -7
- polyaxon/_deploy/schemas/proxy.py +1 -0
- polyaxon/_deploy/schemas/service.py +11 -1
- polyaxon/_docker/converter/base/base.py +8 -0
- polyaxon/_docker/executor.py +10 -4
- polyaxon/_env_vars/getters/owner_entity.py +4 -2
- polyaxon/_env_vars/getters/project.py +4 -2
- polyaxon/_env_vars/getters/run.py +5 -2
- polyaxon/_env_vars/keys.py +7 -1
- polyaxon/_flow/__init__.py +2 -0
- polyaxon/_flow/builds/__init__.py +19 -6
- polyaxon/_flow/component/base.py +1 -0
- polyaxon/_flow/component/component.py +14 -0
- polyaxon/_flow/environment/__init__.py +8 -8
- polyaxon/_flow/hooks/__init__.py +19 -6
- polyaxon/_flow/init/__init__.py +6 -6
- polyaxon/_flow/matrix/iterative.py +0 -1
- polyaxon/_flow/matrix/tuner.py +18 -6
- polyaxon/_flow/operations/operation.py +44 -17
- polyaxon/_flow/plugins/__init__.py +6 -0
- polyaxon/_flow/run/__init__.py +2 -2
- polyaxon/_flow/run/dag.py +2 -2
- polyaxon/_flow/run/dask/dask.py +0 -1
- polyaxon/_flow/run/dask/replica.py +3 -3
- polyaxon/_flow/run/enums.py +5 -0
- polyaxon/_flow/run/job.py +4 -4
- polyaxon/_flow/run/kubeflow/mpi_job.py +1 -2
- polyaxon/_flow/run/kubeflow/mx_job.py +1 -2
- polyaxon/_flow/run/kubeflow/paddle_job.py +35 -4
- polyaxon/_flow/run/kubeflow/pytorch_job.py +51 -5
- polyaxon/_flow/run/kubeflow/replica.py +4 -4
- polyaxon/_flow/run/kubeflow/scheduling_policy.py +12 -0
- polyaxon/_flow/run/kubeflow/tf_job.py +3 -3
- polyaxon/_flow/run/kubeflow/xgboost_job.py +1 -2
- polyaxon/_flow/run/ray/ray.py +2 -3
- polyaxon/_flow/run/ray/replica.py +3 -3
- polyaxon/_flow/run/service.py +4 -4
- polyaxon/_fs/fs.py +7 -2
- polyaxon/_fs/utils.py +3 -2
- polyaxon/_k8s/converter/base/base.py +2 -1
- polyaxon/_k8s/converter/base/main.py +1 -0
- polyaxon/_k8s/converter/base/sidecar.py +16 -1
- polyaxon/_k8s/converter/common/accelerators.py +7 -4
- polyaxon/_k8s/converter/converters/job.py +1 -1
- polyaxon/_k8s/converter/converters/kubeflow/paddle_job.py +1 -0
- polyaxon/_k8s/converter/converters/kubeflow/pytroch_job.py +2 -0
- polyaxon/_k8s/converter/converters/kubeflow/tf_job.py +1 -0
- polyaxon/_k8s/converter/converters/ray_job.py +4 -2
- polyaxon/_k8s/custom_resources/dask_job.py +3 -0
- polyaxon/_k8s/custom_resources/kubeflow/common.py +4 -1
- polyaxon/_k8s/custom_resources/kubeflow/paddle_job.py +10 -1
- polyaxon/_k8s/custom_resources/kubeflow/pytorch_job.py +14 -1
- polyaxon/_k8s/custom_resources/kubeflow/tf_job.py +4 -0
- polyaxon/_k8s/custom_resources/ray_job.py +3 -0
- polyaxon/_k8s/custom_resources/setter.py +1 -1
- polyaxon/_k8s/executor/async_executor.py +2 -0
- polyaxon/_k8s/executor/base.py +23 -6
- polyaxon/_k8s/logging/async_monitor.py +150 -5
- polyaxon/_k8s/manager/async_manager.py +96 -23
- polyaxon/_k8s/manager/base.py +4 -0
- polyaxon/_k8s/manager/manager.py +282 -134
- polyaxon/_local_process/__init__.py +0 -0
- polyaxon/_local_process/agent.py +6 -0
- polyaxon/_local_process/converter/__init__.py +1 -0
- polyaxon/_local_process/converter/base/__init__.py +1 -0
- polyaxon/_local_process/converter/base/base.py +140 -0
- polyaxon/_local_process/converter/base/containers.py +69 -0
- polyaxon/_local_process/converter/base/env_vars.py +253 -0
- polyaxon/_local_process/converter/base/init.py +414 -0
- polyaxon/_local_process/converter/base/main.py +74 -0
- polyaxon/_local_process/converter/base/mounts.py +82 -0
- polyaxon/_local_process/converter/converters/__init__.py +8 -0
- polyaxon/_local_process/converter/converters/job.py +40 -0
- polyaxon/_local_process/converter/converters/service.py +41 -0
- polyaxon/_local_process/converter/mixins.py +38 -0
- polyaxon/_local_process/executor.py +132 -0
- polyaxon/_local_process/process_types.py +39 -0
- polyaxon/_managers/agent.py +2 -0
- polyaxon/_managers/home.py +2 -1
- polyaxon/_operations/tuner.py +1 -0
- polyaxon/_polyaxonfile/check.py +2 -0
- polyaxon/_polyaxonfile/manager/operations.py +3 -0
- polyaxon/_polyaxonfile/manager/workflows.py +2 -0
- polyaxon/_polyaxonfile/specs/compiled_operation.py +1 -0
- polyaxon/_polyaxonfile/specs/operation.py +1 -0
- polyaxon/_polyaxonfile/specs/sections.py +3 -0
- polyaxon/_pql/manager.py +1 -1
- polyaxon/_runner/agent/async_agent.py +97 -21
- polyaxon/_runner/agent/base_agent.py +27 -9
- polyaxon/_runner/agent/client.py +15 -1
- polyaxon/_runner/agent/sync_agent.py +85 -20
- polyaxon/_runner/converter/converter.py +6 -2
- polyaxon/_runner/executor.py +13 -7
- polyaxon/_schemas/agent.py +27 -1
- polyaxon/_schemas/client.py +30 -3
- polyaxon/_schemas/installation.py +4 -3
- polyaxon/_schemas/lifecycle.py +10 -5
- polyaxon/_schemas/log_handler.py +2 -3
- polyaxon/_schemas/types/artifacts.py +3 -3
- polyaxon/_schemas/types/dockerfile.py +3 -3
- polyaxon/_schemas/types/file.py +3 -3
- polyaxon/_schemas/types/git.py +3 -3
- polyaxon/_schemas/types/tensorboard.py +3 -3
- polyaxon/_sdk/api/agents_v1_api.py +1076 -73
- polyaxon/_sdk/api/organizations_v1_api.py +371 -10
- polyaxon/_sdk/api/project_dashboards_v1_api.py +12 -12
- polyaxon/_sdk/api/project_searches_v1_api.py +12 -12
- polyaxon/_sdk/api/projects_v1_api.py +221 -44
- polyaxon/_sdk/api/runs_v1_api.py +917 -445
- polyaxon/_sdk/api/service_accounts_v1_api.py +16 -16
- polyaxon/_sdk/api/teams_v1_api.py +2827 -375
- polyaxon/_sdk/api/users_v1_api.py +231 -55
- polyaxon/_sdk/async_client/api_client.py +4 -0
- polyaxon/_sdk/schemas/__init__.py +10 -2
- polyaxon/_sdk/schemas/v1_agent.py +2 -1
- polyaxon/_sdk/schemas/v1_agent_reconcile_body_request.py +14 -0
- polyaxon/_sdk/schemas/v1_artifact_tree.py +1 -1
- polyaxon/_sdk/schemas/v1_dashboard_spec.py +4 -0
- polyaxon/_sdk/schemas/v1_events_response.py +4 -0
- polyaxon/_sdk/schemas/v1_organization.py +1 -0
- polyaxon/_sdk/schemas/v1_preset.py +8 -0
- polyaxon/_sdk/schemas/v1_project.py +1 -0
- polyaxon/_sdk/schemas/v1_project_settings.py +4 -2
- polyaxon/_sdk/schemas/v1_run.py +2 -2
- polyaxon/_sdk/schemas/v1_run_edge_lineage.py +14 -0
- polyaxon/_sdk/schemas/v1_run_edges_graph.py +9 -0
- polyaxon/_sdk/schemas/v1_section_spec.py +7 -2
- polyaxon/_sdk/schemas/v1_settings_catalog.py +1 -0
- polyaxon/_sdk/schemas/v1_team.py +3 -0
- polyaxon/_sdk/schemas/v1_user.py +1 -2
- polyaxon/_sdk/schemas/v1_user_access.py +17 -0
- polyaxon/_services/values.py +1 -0
- polyaxon/_sidecar/container/__init__.py +39 -18
- polyaxon/_sidecar/container/monitors/__init__.py +1 -0
- polyaxon/_sidecar/container/monitors/logs.py +10 -13
- polyaxon/_sidecar/container/monitors/spec.py +24 -0
- polyaxon/_sidecar/ignore.py +0 -1
- polyaxon/_utils/fqn_utils.py +25 -2
- polyaxon/client.py +1 -1
- polyaxon/pkg.py +1 -1
- polyaxon/schemas.py +8 -1
- polyaxon/settings.py +6 -0
- {polyaxon-2.0.0rc49.dist-info → polyaxon-2.4.0rc1.dist-info}/METADATA +43 -43
- {polyaxon-2.0.0rc49.dist-info → polyaxon-2.4.0rc1.dist-info}/RECORD +176 -155
- {polyaxon-2.0.0rc49.dist-info → polyaxon-2.4.0rc1.dist-info}/WHEEL +1 -1
- polyaxon/_sdk/schemas/v1_project_user_access.py +0 -10
- {polyaxon-2.0.0rc49.dist-info → polyaxon-2.4.0rc1.dist-info}/LICENSE +0 -0
- {polyaxon-2.0.0rc49.dist-info → polyaxon-2.4.0rc1.dist-info}/entry_points.txt +0 -0
- {polyaxon-2.0.0rc49.dist-info → polyaxon-2.4.0rc1.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
import os
|
1
2
|
import sys
|
2
3
|
|
3
4
|
from typing import Callable, List, Optional, Union
|
@@ -11,8 +12,9 @@ from clipped.utils.responses import get_meta_response
|
|
11
12
|
from clipped.utils.validation import validate_tags
|
12
13
|
from urllib3.exceptions import HTTPError
|
13
14
|
|
14
|
-
from polyaxon._cli.dashboard import get_dashboard_url
|
15
|
+
from polyaxon._cli.dashboard import get_dashboard_url, get_project_subpath_url
|
15
16
|
from polyaxon._cli.errors import handle_cli_error
|
17
|
+
from polyaxon._contexts.paths import get_offline_base_path
|
16
18
|
from polyaxon._schemas.lifecycle import V1ProjectVersionKind
|
17
19
|
from polyaxon._utils.fqn_utils import get_versioned_entity_full_name
|
18
20
|
from polyaxon.client import PolyaxonClient, ProjectClient
|
@@ -168,6 +170,7 @@ def list_project_versions(
|
|
168
170
|
|
169
171
|
def register_project_version(
|
170
172
|
owner: str,
|
173
|
+
team: Optional[str],
|
171
174
|
project_name: str,
|
172
175
|
version: str,
|
173
176
|
kind: V1ProjectVersionKind,
|
@@ -207,7 +210,9 @@ def register_project_version(
|
|
207
210
|
Printer.print(
|
208
211
|
"You can view this version on Polyaxon UI: {}".format(
|
209
212
|
get_dashboard_url(
|
210
|
-
subpath="{}/{}
|
213
|
+
subpath="{}/{}s/{}".format(
|
214
|
+
get_project_subpath_url(owner, team, project_name), kind, version
|
215
|
+
)
|
211
216
|
)
|
212
217
|
)
|
213
218
|
)
|
@@ -215,6 +220,7 @@ def register_project_version(
|
|
215
220
|
|
216
221
|
def copy_project_version(
|
217
222
|
owner: str,
|
223
|
+
team: Optional[str],
|
218
224
|
project_name: str,
|
219
225
|
version: str,
|
220
226
|
kind: V1ProjectVersionKind,
|
@@ -259,8 +265,10 @@ def copy_project_version(
|
|
259
265
|
Printer.print(
|
260
266
|
"You can view this version on Polyaxon UI: {}".format(
|
261
267
|
get_dashboard_url(
|
262
|
-
subpath="{}/{}
|
263
|
-
owner, to_project or project_name,
|
268
|
+
subpath="{}/{}s/{}".format(
|
269
|
+
get_project_subpath_url(owner, team, to_project or project_name),
|
270
|
+
kind,
|
271
|
+
_version.name,
|
264
272
|
)
|
265
273
|
)
|
266
274
|
)
|
@@ -269,6 +277,7 @@ def copy_project_version(
|
|
269
277
|
|
270
278
|
def get_project_version(
|
271
279
|
owner: str,
|
280
|
+
team: Optional[str],
|
272
281
|
project_name: str,
|
273
282
|
kind: V1ProjectVersionKind,
|
274
283
|
version: str,
|
@@ -286,6 +295,17 @@ def get_project_version(
|
|
286
295
|
try:
|
287
296
|
response = polyaxon_client.get_version(kind, version)
|
288
297
|
get_version_details(response, content_callback)
|
298
|
+
Printer.print(
|
299
|
+
"You can view this version on Polyaxon UI: {}".format(
|
300
|
+
get_dashboard_url(
|
301
|
+
subpath="{}/{}s/{}".format(
|
302
|
+
get_project_subpath_url(owner, team, project_name),
|
303
|
+
kind,
|
304
|
+
version,
|
305
|
+
)
|
306
|
+
)
|
307
|
+
)
|
308
|
+
)
|
289
309
|
except (ApiException, HTTPError) as e:
|
290
310
|
handle_cli_error(
|
291
311
|
e,
|
@@ -468,13 +488,16 @@ def stage_project_version(
|
|
468
488
|
|
469
489
|
def open_project_version_dashboard(
|
470
490
|
owner: str,
|
491
|
+
team: Optional[str],
|
471
492
|
project_name: str,
|
472
493
|
kind: V1ProjectVersionKind,
|
473
494
|
version: str,
|
474
495
|
url: str,
|
475
496
|
yes: bool = False,
|
476
497
|
):
|
477
|
-
subpath = "{}/{}
|
498
|
+
subpath = "{}/{}s/{}".format(
|
499
|
+
get_project_subpath_url(owner, team, project_name), kind, version
|
500
|
+
)
|
478
501
|
|
479
502
|
artifact_url = get_dashboard_url(subpath=subpath)
|
480
503
|
if url:
|
@@ -526,7 +549,7 @@ def pull_one_or_many_project_versions(
|
|
526
549
|
owner: str,
|
527
550
|
project_name: str,
|
528
551
|
kind: V1ProjectVersionKind,
|
529
|
-
version: str,
|
552
|
+
version: Optional[str] = None,
|
530
553
|
all_versions: Optional[bool] = None,
|
531
554
|
query: Optional[str] = None,
|
532
555
|
limit: Optional[int] = None,
|
@@ -566,3 +589,113 @@ def pull_one_or_many_project_versions(
|
|
566
589
|
"or pass the flag `-a/--all` to pull versions.",
|
567
590
|
sys_exit=True,
|
568
591
|
)
|
592
|
+
|
593
|
+
|
594
|
+
def push_project_version(
|
595
|
+
owner: str,
|
596
|
+
project_name: str,
|
597
|
+
kind: V1ProjectVersionKind,
|
598
|
+
version: str,
|
599
|
+
path: str,
|
600
|
+
reset_project: bool = False,
|
601
|
+
force: bool = False,
|
602
|
+
clean: bool = False,
|
603
|
+
sys_exit: bool = False,
|
604
|
+
):
|
605
|
+
fqn_version = get_versioned_entity_full_name(owner, project_name, version)
|
606
|
+
polyaxon_client = ProjectClient(
|
607
|
+
owner=owner, project=project_name, manual_exceptions_handling=True
|
608
|
+
)
|
609
|
+
|
610
|
+
try:
|
611
|
+
try:
|
612
|
+
polyaxon_client.load_offline_version(
|
613
|
+
kind=kind,
|
614
|
+
version=version,
|
615
|
+
path=path,
|
616
|
+
project_client=polyaxon_client,
|
617
|
+
reset_project=reset_project,
|
618
|
+
raise_if_not_found=True,
|
619
|
+
)
|
620
|
+
except Exception as _:
|
621
|
+
Printer.error(
|
622
|
+
"Could not load offline version `{}`.".format(version),
|
623
|
+
sys_exit=sys_exit,
|
624
|
+
)
|
625
|
+
return
|
626
|
+
|
627
|
+
Printer.header(
|
628
|
+
"Pushing {} version [white]`{}`[/white] ...".format(kind, fqn_version),
|
629
|
+
)
|
630
|
+
polyaxon_client.push_version(
|
631
|
+
kind,
|
632
|
+
version,
|
633
|
+
path=path,
|
634
|
+
force=force,
|
635
|
+
clean=clean,
|
636
|
+
)
|
637
|
+
Printer.success(
|
638
|
+
"Finished pushing the {} version `{}` from `{}`".format(
|
639
|
+
kind, fqn_version, path
|
640
|
+
)
|
641
|
+
)
|
642
|
+
except (ApiException, HTTPError) as e:
|
643
|
+
handle_cli_error(
|
644
|
+
e,
|
645
|
+
message="Could not push the {} version `{}`".format(kind, fqn_version),
|
646
|
+
)
|
647
|
+
|
648
|
+
|
649
|
+
def push_one_or_many_project_versions(
|
650
|
+
owner: str,
|
651
|
+
project_name: str,
|
652
|
+
kind: V1ProjectVersionKind,
|
653
|
+
path: str,
|
654
|
+
version: Optional[str] = None,
|
655
|
+
all_versions: Optional[bool] = None,
|
656
|
+
reset_project: bool = False,
|
657
|
+
force: bool = False,
|
658
|
+
clean: bool = False,
|
659
|
+
):
|
660
|
+
def _push(version_name: str):
|
661
|
+
push_project_version(
|
662
|
+
owner=owner,
|
663
|
+
project_name=project_name,
|
664
|
+
kind=kind,
|
665
|
+
version=version_name,
|
666
|
+
path=path,
|
667
|
+
reset_project=reset_project,
|
668
|
+
force=force,
|
669
|
+
clean=clean,
|
670
|
+
)
|
671
|
+
|
672
|
+
offline_path = get_offline_base_path(
|
673
|
+
entity_kind=kind,
|
674
|
+
path=path,
|
675
|
+
)
|
676
|
+
|
677
|
+
if all_versions:
|
678
|
+
if (
|
679
|
+
not os.path.exists(offline_path)
|
680
|
+
or not os.path.isdir(offline_path)
|
681
|
+
or not os.listdir(offline_path)
|
682
|
+
):
|
683
|
+
Printer.error(
|
684
|
+
f"Could not push offline {kind} versions, the path `{offline_path}` "
|
685
|
+
f"does not exist, is not a directory, or is empty."
|
686
|
+
)
|
687
|
+
sys.exit(1)
|
688
|
+
version_paths = os.listdir(offline_path)
|
689
|
+
Printer.header(
|
690
|
+
f"Pushing local {kind} versions (total: {len(version_paths)}) ..."
|
691
|
+
)
|
692
|
+
for idx, uid in enumerate(version_paths):
|
693
|
+
Printer.heading(f"Pushing {kind} version {idx + 1}/{len(offline_path)} ...")
|
694
|
+
_push(uid)
|
695
|
+
elif version:
|
696
|
+
_push(version)
|
697
|
+
else:
|
698
|
+
Printer.error(
|
699
|
+
"Please provide a version name, or pass the flag `-a/--all` to pull versions.",
|
700
|
+
sys_exit=True,
|
701
|
+
)
|
polyaxon/_cli/projects.py
CHANGED
@@ -8,7 +8,7 @@ from clipped.utils.responses import get_meta_response
|
|
8
8
|
from clipped.utils.validation import validate_tags
|
9
9
|
from urllib3.exceptions import HTTPError
|
10
10
|
|
11
|
-
from polyaxon._cli.dashboard import get_dashboard_url
|
11
|
+
from polyaxon._cli.dashboard import get_dashboard_url, get_project_subpath_url
|
12
12
|
from polyaxon._cli.errors import handle_cli_error
|
13
13
|
from polyaxon._cli.init import init as init_project
|
14
14
|
from polyaxon._cli.options import OPTIONS_NAME, OPTIONS_OWNER, OPTIONS_PROJECT
|
@@ -19,6 +19,7 @@ from polyaxon._env_vars.getters.user import get_local_owner
|
|
19
19
|
from polyaxon._managers.project import ProjectConfigManager
|
20
20
|
from polyaxon._utils import cache
|
21
21
|
from polyaxon._utils.cache import get_local_project
|
22
|
+
from polyaxon._utils.fqn_utils import get_owner_team_space
|
22
23
|
from polyaxon.client import ProjectClient, V1Project
|
23
24
|
from polyaxon.exceptions import ApiException
|
24
25
|
from polyaxon.logger import clean_outputs
|
@@ -74,7 +75,7 @@ def create(ctx, name, description, tags, public, init):
|
|
74
75
|
command_help="project create",
|
75
76
|
sys_exit=True,
|
76
77
|
)
|
77
|
-
owner, project_name = resolve_entity_info(
|
78
|
+
owner, team, project_name = resolve_entity_info(
|
78
79
|
name or ctx.obj.get("project"), is_cli=True, entity_name="project"
|
79
80
|
)
|
80
81
|
|
@@ -90,7 +91,9 @@ def create(ctx, name, description, tags, public, init):
|
|
90
91
|
project_config = V1Project(
|
91
92
|
name=project_name, description=description, tags=tags, is_public=public
|
92
93
|
)
|
93
|
-
polyaxon_client = ProjectClient(
|
94
|
+
polyaxon_client = ProjectClient(
|
95
|
+
owner=get_owner_team_space(owner, team), manual_exceptions_handling=True
|
96
|
+
)
|
94
97
|
_project = polyaxon_client.create(project_config)
|
95
98
|
config = polyaxon_client.client.sanitize_for_serialization(_project)
|
96
99
|
cache.cache(config_manager=ProjectConfigManager, config=config)
|
@@ -103,7 +106,9 @@ def create(ctx, name, description, tags, public, init):
|
|
103
106
|
Printer.success("Project `{}` was created successfully.".format(_project.name))
|
104
107
|
Printer.print(
|
105
108
|
"You can view this project on Polyaxon UI: {}".format(
|
106
|
-
get_dashboard_url(
|
109
|
+
get_dashboard_url(
|
110
|
+
subpath=get_project_subpath_url(owner, team, _project.name)
|
111
|
+
)
|
107
112
|
)
|
108
113
|
)
|
109
114
|
|
@@ -195,7 +200,7 @@ def get(ctx, _project):
|
|
195
200
|
\b
|
196
201
|
$ polyaxon project get -p owner/project
|
197
202
|
"""
|
198
|
-
owner, project_name = get_project_or_local(
|
203
|
+
owner, team, project_name = get_project_or_local(
|
199
204
|
_project or ctx.obj.get("project"), is_cli=True
|
200
205
|
)
|
201
206
|
|
@@ -214,6 +219,13 @@ def get(ctx, _project):
|
|
214
219
|
project=project_name,
|
215
220
|
)
|
216
221
|
get_entity_details(polyaxon_client.project_data, "Project")
|
222
|
+
Printer.print(
|
223
|
+
"You can view this project on Polyaxon UI: {}".format(
|
224
|
+
get_dashboard_url(
|
225
|
+
subpath=get_project_subpath_url(owner, team, project_name)
|
226
|
+
)
|
227
|
+
)
|
228
|
+
)
|
217
229
|
except (ApiException, HTTPError) as e:
|
218
230
|
handle_cli_error(
|
219
231
|
e, message="Could not get project `{}`.".format(project_name), sys_exit=True
|
@@ -237,7 +249,7 @@ def delete(ctx, _project, yes):
|
|
237
249
|
|
238
250
|
Uses /docs/core/cli/#caching
|
239
251
|
"""
|
240
|
-
owner, project_name = get_project_or_local(
|
252
|
+
owner, _, project_name = get_project_or_local(
|
241
253
|
_project or ctx.obj.get("project"), is_cli=True
|
242
254
|
)
|
243
255
|
|
@@ -300,7 +312,7 @@ def update(ctx, _project, name, description, tags, private):
|
|
300
312
|
\b
|
301
313
|
$ polyaxon update --tags="foo, bar"
|
302
314
|
"""
|
303
|
-
owner, project_name = get_project_or_local(
|
315
|
+
owner, _, project_name = get_project_or_local(
|
304
316
|
_project or ctx.obj.get("project"), is_cli=True
|
305
317
|
)
|
306
318
|
|
@@ -357,10 +369,12 @@ def update(ctx, _project, name, description, tags, private):
|
|
357
369
|
@clean_outputs
|
358
370
|
def dashboard(ctx, _project, yes, url):
|
359
371
|
"""Open this project's dashboard details in browser."""
|
360
|
-
owner, project_name = get_project_or_local(
|
372
|
+
owner, team, project_name = get_project_or_local(
|
361
373
|
_project or ctx.obj.get("project"), is_cli=True
|
362
374
|
)
|
363
|
-
project_url = get_dashboard_url(
|
375
|
+
project_url = get_dashboard_url(
|
376
|
+
subpath=get_project_subpath_url(owner, team, project_name)
|
377
|
+
)
|
364
378
|
if url:
|
365
379
|
Printer.header("The dashboard is available at: {}".format(project_url))
|
366
380
|
sys.exit(0)
|
polyaxon/_cli/run.py
CHANGED
@@ -10,10 +10,11 @@ from clipped.utils import git as git_utils
|
|
10
10
|
from clipped.utils.validation import validate_tags
|
11
11
|
from urllib3.exceptions import HTTPError
|
12
12
|
|
13
|
-
from polyaxon._cli.dashboard import get_dashboard_url
|
13
|
+
from polyaxon._cli.dashboard import get_dashboard_url, get_project_subpath_url
|
14
14
|
from polyaxon._cli.errors import handle_cli_error
|
15
15
|
from polyaxon._cli.operations import approve
|
16
16
|
from polyaxon._cli.operations import execute as run_execute
|
17
|
+
from polyaxon._cli.operations import get_op_agent_host
|
17
18
|
from polyaxon._cli.operations import logs as run_logs
|
18
19
|
from polyaxon._cli.operations import shell as run_shell
|
19
20
|
from polyaxon._cli.operations import statuses
|
@@ -30,6 +31,7 @@ from polyaxon._polyaxonfile import check_polyaxonfile
|
|
30
31
|
from polyaxon._runner.kinds import RunnerKind
|
31
32
|
from polyaxon._schemas.lifecycle import ManagedBy
|
32
33
|
from polyaxon._utils import cache
|
34
|
+
from polyaxon._utils.fqn_utils import get_owner_team_space
|
33
35
|
from polyaxon.client import RunClient
|
34
36
|
from polyaxon.exceptions import ApiException
|
35
37
|
from polyaxon.logger import clean_outputs
|
@@ -43,6 +45,7 @@ def _run(
|
|
43
45
|
ctx,
|
44
46
|
name: str,
|
45
47
|
owner: str,
|
48
|
+
team: Optional[str],
|
46
49
|
project_name: str,
|
47
50
|
description: str,
|
48
51
|
tags: List[str],
|
@@ -61,11 +64,14 @@ def _run(
|
|
61
64
|
owner=owner, project=project_name, manual_exceptions_handling=True
|
62
65
|
)
|
63
66
|
|
67
|
+
owner_team = get_owner_team_space(owner, team)
|
68
|
+
project_url = get_project_subpath_url(owner, team, project_name)
|
69
|
+
|
64
70
|
def get_instance_info(r):
|
65
71
|
rn = (
|
66
72
|
f"[white]{r.name}[/white]@[white]{r.uuid}[/white]"
|
67
73
|
if r.name
|
68
|
-
else "[white]{r.uuid}[/white]"
|
74
|
+
else f"[white]{r.uuid}[/white]"
|
69
75
|
)
|
70
76
|
return f"[white]{owner}[/white]/[white]{project_name}[/white]:{rn}"
|
71
77
|
|
@@ -93,8 +99,9 @@ def _run(
|
|
93
99
|
meta_info=meta_info,
|
94
100
|
pending=pending,
|
95
101
|
)
|
102
|
+
host_kwargs = get_op_agent_host(response.settings)
|
96
103
|
run_url = get_dashboard_url(
|
97
|
-
subpath="{}/
|
104
|
+
subpath="{}/runs/{}".format(project_url, response.uuid), **host_kwargs
|
98
105
|
)
|
99
106
|
if output:
|
100
107
|
response_data = polyaxon_client.client.sanitize_for_serialization(
|
@@ -125,26 +132,38 @@ def _run(
|
|
125
132
|
|
126
133
|
def execute_run_locally(run_uuid: str):
|
127
134
|
ctx.obj = {
|
128
|
-
"project": "{}/{}".format(
|
135
|
+
"project": "{}/{}".format(owner_team, project_name),
|
129
136
|
"run_uuid": run_uuid,
|
130
137
|
"executor": executor,
|
131
138
|
}
|
132
139
|
ctx.invoke(run_execute)
|
133
140
|
|
134
141
|
def watch_run_statuses(run_uuid: str):
|
135
|
-
ctx.obj = {
|
142
|
+
ctx.obj = {
|
143
|
+
"project": "{}/{}".format(owner_team, project_name),
|
144
|
+
"run_uuid": run_uuid,
|
145
|
+
}
|
136
146
|
ctx.invoke(statuses, watch=True)
|
137
147
|
|
138
148
|
def watch_run_logs(run_uuid: str):
|
139
|
-
ctx.obj = {
|
149
|
+
ctx.obj = {
|
150
|
+
"project": "{}/{}".format(owner_team, project_name),
|
151
|
+
"run_uuid": run_uuid,
|
152
|
+
}
|
140
153
|
ctx.invoke(run_logs)
|
141
154
|
|
142
155
|
def start_run_shell(run_uuid: str):
|
143
|
-
ctx.obj = {
|
156
|
+
ctx.obj = {
|
157
|
+
"project": "{}/{}".format(owner_team, project_name),
|
158
|
+
"run_uuid": run_uuid,
|
159
|
+
}
|
144
160
|
ctx.invoke(run_shell)
|
145
161
|
|
146
162
|
def upload_run(run_uuid: str):
|
147
|
-
ctx.obj = {
|
163
|
+
ctx.obj = {
|
164
|
+
"project": "{}/{}".format(owner_team, project_name),
|
165
|
+
"run_uuid": run_uuid,
|
166
|
+
}
|
148
167
|
ctx.invoke(
|
149
168
|
run_upload, path_to=upload_to, path_from=upload_from, sync_failure=True
|
150
169
|
)
|
@@ -334,6 +353,12 @@ def _run(
|
|
334
353
|
"If the name is not namespaced by the agent name the default agent is used: "
|
335
354
|
"queue-name or agent-name/queue-name",
|
336
355
|
)
|
356
|
+
@click.option(
|
357
|
+
"--namespace",
|
358
|
+
"-ns",
|
359
|
+
type=str,
|
360
|
+
help="Namespace to use for this run. By default it will use the agent's namespace.",
|
361
|
+
)
|
337
362
|
@click.option(
|
338
363
|
"--nocache",
|
339
364
|
is_flag=True,
|
@@ -412,6 +437,7 @@ def run(
|
|
412
437
|
matrix_num_runs,
|
413
438
|
presets,
|
414
439
|
queue,
|
440
|
+
namespace,
|
415
441
|
nocache,
|
416
442
|
cache,
|
417
443
|
approved,
|
@@ -533,6 +559,7 @@ def run(
|
|
533
559
|
matrix_num_runs=matrix_num_runs,
|
534
560
|
presets=presets,
|
535
561
|
queue=queue,
|
562
|
+
namespace=namespace,
|
536
563
|
cache=cache,
|
537
564
|
nocache=nocache,
|
538
565
|
approved=approved,
|
@@ -547,13 +574,14 @@ def run(
|
|
547
574
|
Printer.print("Please customize the specification or disable the template!")
|
548
575
|
sys.exit(1)
|
549
576
|
|
550
|
-
owner, project_name = get_project_or_local(project, is_cli=True)
|
577
|
+
owner, team, project_name = get_project_or_local(project, is_cli=True)
|
551
578
|
tags = validate_tags(tags, validate_yaml=True)
|
552
579
|
|
553
580
|
_run(
|
554
581
|
ctx=ctx,
|
555
582
|
name=name,
|
556
583
|
owner=owner,
|
584
|
+
team=team,
|
557
585
|
project_name=project_name,
|
558
586
|
description=description,
|
559
587
|
tags=tags,
|
polyaxon/_cli/services/agent.py
CHANGED
@@ -33,7 +33,7 @@ def agent():
|
|
33
33
|
help="Number of times to retry the process.",
|
34
34
|
)
|
35
35
|
@coroutine
|
36
|
-
async def start(kind,
|
36
|
+
async def start(kind, max_interval, max_retries):
|
37
37
|
from polyaxon import settings
|
38
38
|
from polyaxon._env_vars.getters import get_agent_info
|
39
39
|
from polyaxon._runner.kinds import RunnerKind
|
@@ -65,7 +65,7 @@ async def start(kind, max_retries, max_interval):
|
|
65
65
|
await ag.start()
|
66
66
|
return
|
67
67
|
except Exception as e:
|
68
|
-
logger.warning("Polyaxon agent retrying, error %
|
68
|
+
logger.warning("Polyaxon agent retrying, error %r", e)
|
69
69
|
retry += 1
|
70
70
|
|
71
71
|
|
@@ -36,9 +36,15 @@ from polyaxon.logger import logger
|
|
36
36
|
default=False,
|
37
37
|
help="Enable logs monitoring.",
|
38
38
|
)
|
39
|
+
@click.option(
|
40
|
+
"--monitor-spec",
|
41
|
+
is_flag=True,
|
42
|
+
default=False,
|
43
|
+
help="Enable spec monitoring.",
|
44
|
+
)
|
39
45
|
@coroutine
|
40
46
|
async def sidecar(
|
41
|
-
container_id, max_retries, sleep_interval, sync_interval, monitor_logs
|
47
|
+
container_id, max_retries, sleep_interval, sync_interval, monitor_logs, monitor_spec
|
42
48
|
):
|
43
49
|
"""
|
44
50
|
Start Polyaxon's sidecar command.
|
@@ -56,6 +62,7 @@ async def sidecar(
|
|
56
62
|
sync_interval=sync_interval,
|
57
63
|
monitor_outputs=True,
|
58
64
|
monitor_logs=monitor_logs,
|
65
|
+
monitor_spec=monitor_spec,
|
59
66
|
)
|
60
67
|
return
|
61
68
|
except Exception as e:
|
polyaxon/_client/client.py
CHANGED
@@ -92,6 +92,7 @@ class PolyaxonClient:
|
|
92
92
|
self._users_v1 = None
|
93
93
|
self._versions_v1 = None
|
94
94
|
self._agents_v1 = None
|
95
|
+
self._internal_agents_v1 = None
|
95
96
|
self._queues_v1 = None
|
96
97
|
self._service_accounts_v1 = None
|
97
98
|
self._presets_v1 = None
|
@@ -109,6 +110,15 @@ class PolyaxonClient:
|
|
109
110
|
)
|
110
111
|
return ApiClient(self.config.sdk_config, **self.config.client_header)
|
111
112
|
|
113
|
+
def _get_internal_client(self):
|
114
|
+
if self.is_async:
|
115
|
+
return AsyncApiClient(
|
116
|
+
self.config.internal_sdk_config, **self.config.get_internal_header()
|
117
|
+
)
|
118
|
+
return ApiClient(
|
119
|
+
self.config.internal_sdk_config, **self.config.get_internal_header()
|
120
|
+
)
|
121
|
+
|
112
122
|
def reset(self):
|
113
123
|
self._projects_v1 = None
|
114
124
|
self._runs_v1 = None
|
@@ -118,6 +128,7 @@ class PolyaxonClient:
|
|
118
128
|
self._users_v1 = None
|
119
129
|
self._versions_v1 = None
|
120
130
|
self._agents_v1 = None
|
131
|
+
self._internal_agents_v1 = None
|
121
132
|
self._queues_v1 = None
|
122
133
|
self._service_accounts_v1 = None
|
123
134
|
self._presets_v1 = None
|
@@ -169,6 +180,12 @@ class PolyaxonClient:
|
|
169
180
|
self._agents_v1 = AgentsV1Api(self.api_client)
|
170
181
|
return self._agents_v1
|
171
182
|
|
183
|
+
@property
|
184
|
+
def internal_agents_v1(self):
|
185
|
+
if not self._internal_agents_v1:
|
186
|
+
self._internal_agents_v1 = AgentsV1Api(self._get_internal_client())
|
187
|
+
return self._internal_agents_v1
|
188
|
+
|
172
189
|
@property
|
173
190
|
def queues_v1(self):
|
174
191
|
if not self._queues_v1:
|
@@ -0,0 +1,39 @@
|
|
1
|
+
from polyaxon import settings
|
2
|
+
from polyaxon._client.client import PolyaxonClient
|
3
|
+
from polyaxon._schemas.client import ClientConfig
|
4
|
+
from polyaxon._utils.fqn_utils import split_owner_team_space
|
5
|
+
|
6
|
+
|
7
|
+
class ClientMixin:
|
8
|
+
@property
|
9
|
+
def client(self):
|
10
|
+
if self._client:
|
11
|
+
return self._client
|
12
|
+
self._client = PolyaxonClient()
|
13
|
+
return self._client
|
14
|
+
|
15
|
+
def reset_client(self, **kwargs):
|
16
|
+
if not settings.CLIENT_CONFIG.in_cluster:
|
17
|
+
self._client = PolyaxonClient(
|
18
|
+
ClientConfig.patch_from(settings.CLIENT_CONFIG, **kwargs)
|
19
|
+
)
|
20
|
+
|
21
|
+
@property
|
22
|
+
def owner(self) -> str:
|
23
|
+
return self._owner
|
24
|
+
|
25
|
+
@property
|
26
|
+
def team(self):
|
27
|
+
return self._team
|
28
|
+
|
29
|
+
@property
|
30
|
+
def project(self) -> str:
|
31
|
+
return self._project
|
32
|
+
|
33
|
+
def set_project(self, project: str):
|
34
|
+
self._project = project
|
35
|
+
|
36
|
+
def set_owner(self, owner: str):
|
37
|
+
owner, team = split_owner_team_space(owner)
|
38
|
+
self._owner = owner
|
39
|
+
self._team = team
|