polyaxon 2.2.0.post1__py3-none-any.whl → 2.2.0rc0__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.
@@ -21,11 +21,7 @@ from clipped.utils.versions import compare_versions
21
21
  from urllib3.exceptions import HTTPError
22
22
 
23
23
  from polyaxon import settings
24
- from polyaxon._cli.dashboard import (
25
- get_dashboard,
26
- get_dashboard_url,
27
- get_project_subpath_url,
28
- )
24
+ from polyaxon._cli.dashboard import get_dashboard, get_dashboard_url
29
25
  from polyaxon._cli.errors import handle_cli_error, is_in_ce
30
26
  from polyaxon._cli.options import (
31
27
  OPTIONS_NAME,
@@ -51,7 +47,7 @@ from polyaxon.api import (
51
47
  REWRITE_SERVICES_V1,
52
48
  SERVICES_V1,
53
49
  )
54
- from polyaxon.client import RunClient, V1Run, V1RunSettings, get_run_logs
50
+ from polyaxon.client import RunClient, V1Run, get_run_logs
55
51
  from polyaxon.exceptions import (
56
52
  ApiException,
57
53
  PolyaxonClientException,
@@ -86,14 +82,6 @@ DEFAULT_EXCLUDE = [
86
82
  ]
87
83
 
88
84
 
89
- def get_op_agent_host(runSettings: V1RunSettings):
90
- host_kwargs = {}
91
- if runSettings and runSettings.agent and runSettings.agent.url:
92
- host_kwargs["host"] = runSettings.agent.url
93
-
94
- return host_kwargs
95
-
96
-
97
85
  def handle_run_statuses(status, conditions, table):
98
86
  if not conditions:
99
87
  return False
@@ -298,7 +286,7 @@ def ls(
298
286
  else:
299
287
  Printer.warning(f"Skipping run {uid}, offline data not found.")
300
288
  else:
301
- owner, _, project_name = get_project_or_local(
289
+ owner, project_name = get_project_or_local(
302
290
  project or ctx.obj.get("project"), is_cli=True
303
291
  )
304
292
 
@@ -443,7 +431,7 @@ def get(ctx, project, uid, offline, path, output):
443
431
  sys.exit(1)
444
432
  run_data = RunConfigManager.read_from_path(offline_path)
445
433
  else:
446
- owner, team, project_name, run_uuid = get_project_run_or_local(
434
+ owner, project_name, run_uuid = get_project_run_or_local(
447
435
  project or ctx.obj.get("project"),
448
436
  uid,
449
437
  is_cli=True,
@@ -468,9 +456,7 @@ def get(ctx, project, uid, offline, path, output):
468
456
  )
469
457
  if output:
470
458
  run_url = get_dashboard_url(
471
- subpath="{}/runs/{}".format(
472
- get_project_subpath_url(owner, team, project_name), run_uuid
473
- )
459
+ subpath="{}/{}/runs/{}".format(owner, project_name, run_uuid)
474
460
  )
475
461
  config["url"] = run_url
476
462
  handle_output(config, output)
@@ -543,7 +529,7 @@ def delete(ctx, project, uid, yes, offline, path):
543
529
  return
544
530
 
545
531
  # Resume normal flow
546
- owner, _, project_name, run_uuid = get_project_run_or_local(
532
+ owner, project_name, run_uuid = get_project_run_or_local(
547
533
  project or ctx.obj.get("project"),
548
534
  uid or ctx.obj.get("run_uuid"),
549
535
  is_cli=True,
@@ -638,7 +624,7 @@ def update(ctx, project, uid, name, description, tags, offline, path):
638
624
  )
639
625
  sys.exit(1)
640
626
  else:
641
- owner, _, project_name, run_uuid = get_project_run_or_local(
627
+ owner, project_name, run_uuid = get_project_run_or_local(
642
628
  project or ctx.obj.get("project"),
643
629
  uid or ctx.obj.get("run_uuid"),
644
630
  is_cli=True,
@@ -677,7 +663,7 @@ def approve(ctx, project, uid):
677
663
  \b
678
664
  $ polyaxon ops approve --uid 8aac02e3a62a4f0aaa257c59da5eab80
679
665
  """
680
- owner, _, project_name, run_uuid = get_project_run_or_local(
666
+ owner, project_name, run_uuid = get_project_run_or_local(
681
667
  project or ctx.obj.get("project"),
682
668
  uid or ctx.obj.get("run_uuid"),
683
669
  is_cli=True,
@@ -724,7 +710,7 @@ def stop(ctx, project, uid, yes):
724
710
  \b
725
711
  $ polyaxon ops stop --uid 8aac02e3a62a4f0aaa257c59da5eab80
726
712
  """
727
- owner, _, project_name, run_uuid = get_project_run_or_local(
713
+ owner, project_name, run_uuid = get_project_run_or_local(
728
714
  project or ctx.obj.get("project"),
729
715
  uid or ctx.obj.get("run_uuid"),
730
716
  is_cli=True,
@@ -776,7 +762,7 @@ def skip(ctx, project, uid, yes):
776
762
  \b
777
763
  $ polyaxon ops skip --uid 8aac02e3a62a4f0aaa257c59da5eab80
778
764
  """
779
- owner, _, project_name, run_uuid = get_project_run_or_local(
765
+ owner, project_name, run_uuid = get_project_run_or_local(
780
766
  project or ctx.obj.get("project"),
781
767
  uid or ctx.obj.get("run_uuid"),
782
768
  is_cli=True,
@@ -880,7 +866,7 @@ def restart(
880
866
  if polyaxonfile:
881
867
  content = OperationSpecification.read(polyaxonfile, is_preset=True).to_json()
882
868
 
883
- owner, _, project_name, run_uuid = get_project_run_or_local(
869
+ owner, project_name, run_uuid = get_project_run_or_local(
884
870
  project or ctx.obj.get("project"),
885
871
  uid or ctx.obj.get("run_uuid"),
886
872
  is_cli=True,
@@ -965,7 +951,7 @@ def resume(
965
951
  if polyaxonfile:
966
952
  content = OperationSpecification.read(polyaxonfile, is_preset=True).to_json()
967
953
 
968
- owner, _, project_name, run_uuid = get_project_run_or_local(
954
+ owner, project_name, run_uuid = get_project_run_or_local(
969
955
  project or ctx.obj.get("project"),
970
956
  uid or ctx.obj.get("run_uuid"),
971
957
  is_cli=True,
@@ -1008,7 +994,7 @@ def invalidate(ctx, project, uid):
1008
994
  \b
1009
995
  $ polyaxon ops invalidate --uid 8aac02e3a62a4f0aaa257c59da5eab80
1010
996
  """
1011
- owner, _, project_name, run_uuid = get_project_run_or_local(
997
+ owner, project_name, run_uuid = get_project_run_or_local(
1012
998
  project or ctx.obj.get("project"),
1013
999
  uid or ctx.obj.get("run_uuid"),
1014
1000
  is_cli=True,
@@ -1197,7 +1183,7 @@ def execute(ctx, project, uid, executor):
1197
1183
  message="Operation failed.\n{}".format(result["message"]),
1198
1184
  )
1199
1185
 
1200
- owner, _, project_name, run_uuid = get_project_run_or_local(
1186
+ owner, project_name, run_uuid = get_project_run_or_local(
1201
1187
  project or ctx.obj.get("project"),
1202
1188
  uid or ctx.obj.get("run_uuid"),
1203
1189
  is_cli=True,
@@ -1321,7 +1307,7 @@ def statuses(ctx, project, uid, watch, offline, path):
1321
1307
  sys.exit(1)
1322
1308
  return
1323
1309
 
1324
- owner, _, project_name, run_uuid = get_project_run_or_local(
1310
+ owner, project_name, run_uuid = get_project_run_or_local(
1325
1311
  project or ctx.obj.get("project"),
1326
1312
  uid or ctx.obj.get("run_uuid"),
1327
1313
  is_cli=True,
@@ -1389,7 +1375,7 @@ def statuses(ctx, project, uid, watch, offline, path):
1389
1375
  # )
1390
1376
  # sys.exit(1)
1391
1377
  #
1392
- # owner, team, project_name, run_uuid = get_project_run_or_local(
1378
+ # owner, project_name, run_uuid = get_project_run_or_local(
1393
1379
  # ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True,
1394
1380
  # )
1395
1381
  #
@@ -1481,7 +1467,7 @@ def logs(ctx, project, uid, follow, hide_time, all_containers, all_info, offline
1481
1467
  sys.exit(1)
1482
1468
  return
1483
1469
 
1484
- owner, _, project_name, run_uuid = get_project_run_or_local(
1470
+ owner, project_name, run_uuid = get_project_run_or_local(
1485
1471
  project or ctx.obj.get("project"),
1486
1472
  uid or ctx.obj.get("run_uuid"),
1487
1473
  is_cli=True,
@@ -1527,7 +1513,7 @@ def inspect(ctx, project, uid):
1527
1513
  \b
1528
1514
  $ polyaxon ops inspect -p acme/project -uid 8aac02e3a62a4f0aaa257c59da5eab80
1529
1515
  """
1530
- owner, _, project_name, run_uuid = get_project_run_or_local(
1516
+ owner, project_name, run_uuid = get_project_run_or_local(
1531
1517
  project or ctx.obj.get("project"),
1532
1518
  uid or ctx.obj.get("run_uuid"),
1533
1519
  is_cli=True,
@@ -1586,7 +1572,7 @@ def shell(ctx, project, uid, command, pod, container):
1586
1572
  """
1587
1573
  from polyaxon._vendor.shell_pty import PseudoTerminal
1588
1574
 
1589
- owner, _, project_name, run_uuid = get_project_run_or_local(
1575
+ owner, project_name, run_uuid = get_project_run_or_local(
1590
1576
  project or ctx.obj.get("project"),
1591
1577
  uid or ctx.obj.get("run_uuid"),
1592
1578
  is_cli=True,
@@ -1691,7 +1677,7 @@ def artifacts(
1691
1677
  \b
1692
1678
  $ polyaxon ops artifacts -uid 8aac02e3a62a4f0aaa257c59da5eab80 -l-kind model -l-kind env --path="this/path"
1693
1679
  """
1694
- owner, _, project_name, run_uuid = get_project_run_or_local(
1680
+ owner, project_name, run_uuid = get_project_run_or_local(
1695
1681
  project or ctx.obj.get("project"),
1696
1682
  uid or ctx.obj.get("run_uuid"),
1697
1683
  is_cli=True,
@@ -1869,7 +1855,7 @@ def upload(ctx, project, uid, path_from, path_to, sync_failure):
1869
1855
  \b
1870
1856
  $ polyaxon ops upload -uid 8aac02e3a62a4f0aaa257c59da5eab80 --path-to="path/to/upload/to"
1871
1857
  """
1872
- owner, _, project_name, run_uuid = get_project_run_or_local(
1858
+ owner, project_name, run_uuid = get_project_run_or_local(
1873
1859
  project or ctx.obj.get("project"),
1874
1860
  uid or ctx.obj.get("run_uuid"),
1875
1861
  is_cli=True,
@@ -1943,7 +1929,7 @@ def transfer(ctx, project, uid, to_project):
1943
1929
  \b
1944
1930
  $ polyaxon ops transfer -p acme/foobar -uid 8aac02e3a62a4f0aaa257c59da5eab80 -to=dest-project
1945
1931
  """
1946
- owner, _, project_name, run_uuid = get_project_run_or_local(
1932
+ owner, project_name, run_uuid = get_project_run_or_local(
1947
1933
  project or ctx.obj.get("project"),
1948
1934
  uid or ctx.obj.get("run_uuid"),
1949
1935
  is_cli=True,
@@ -2011,16 +1997,13 @@ def dashboard(ctx, project, uid, yes, url, offline, path, server_config):
2011
1997
  sys.exit(1)
2012
1998
  run_data = RunConfigManager.read_from_path(offline_path)
2013
1999
  owner, project_name, run_uuid = run_data.owner, run_data.project, run_data.uuid
2014
- team = None
2015
2000
  else:
2016
- owner, team, project_name, run_uuid = get_project_run_or_local(
2001
+ owner, project_name, run_uuid = get_project_run_or_local(
2017
2002
  project or ctx.obj.get("project"),
2018
2003
  uid or ctx.obj.get("run_uuid"),
2019
2004
  is_cli=True,
2020
2005
  )
2021
- subpath = "{}/runs/{}".format(
2022
- get_project_subpath_url(owner, team, project_name), run_uuid
2023
- )
2006
+ subpath = "{}/{}/runs/{}".format(owner, project_name, run_uuid)
2024
2007
  dashboard_url = get_dashboard_url(subpath=subpath)
2025
2008
  get_dashboard(dashboard_url=dashboard_url, url_only=url, yes=yes)
2026
2009
  if offline:
@@ -2064,7 +2047,7 @@ def service(ctx, project, uid, yes, external, url):
2064
2047
  You can open the service embedded in Polyaxon UI or using the real service URL,
2065
2048
  please use the `--external` flag.
2066
2049
  """
2067
- owner, team, project_name, run_uuid = get_project_run_or_local(
2050
+ owner, project_name, run_uuid = get_project_run_or_local(
2068
2051
  project or ctx.obj.get("project"),
2069
2052
  uid or ctx.obj.get("run_uuid"),
2070
2053
  is_cli=True,
@@ -2097,12 +2080,8 @@ def service(ctx, project, uid, yes, external, url):
2097
2080
 
2098
2081
  wait_for_running_condition(client)
2099
2082
 
2100
- host_kwargs = get_op_agent_host(client.settings)
2101
2083
  run_url = get_dashboard_url(
2102
- subpath="{}/runs/{}/service".format(
2103
- get_project_subpath_url(owner, team, project_name), run_uuid
2104
- ),
2105
- **host_kwargs,
2084
+ subpath="{}/{}/runs/{}/service".format(owner, project_name, run_uuid)
2106
2085
  )
2107
2086
 
2108
2087
  namespace = client.run_data.settings.namespace
@@ -2112,8 +2091,8 @@ def service(ctx, project, uid, yes, external, url):
2112
2091
  if rewrite_path:
2113
2092
  service_endpoint = REWRITE_EXTERNAL_V1 if is_external else REWRITE_SERVICES_V1
2114
2093
 
2115
- service_subpath = "{}/{}/runs/{}/".format(
2116
- get_project_subpath_url(namespace, team, owner), project_name, run_uuid
2094
+ service_subpath = "{}/{}/{}/runs/{}/".format(
2095
+ namespace, owner, project_name, run_uuid
2117
2096
  )
2118
2097
  port = 80
2119
2098
  if client.settings and client.settings.agent:
@@ -2126,9 +2105,9 @@ def service(ctx, project, uid, yes, external, url):
2126
2105
  if port:
2127
2106
  service_subpath = "{}{}/".format(service_subpath, port)
2128
2107
 
2129
- host_kwargs = get_op_agent_host(client.settings)
2130
2108
  external_run_url = get_dashboard_url(
2131
- base=service_endpoint, subpath=service_subpath, **host_kwargs
2109
+ base=service_endpoint,
2110
+ subpath=service_subpath,
2132
2111
  )
2133
2112
 
2134
2113
  if url:
@@ -2209,7 +2188,7 @@ def pull(
2209
2188
  \b
2210
2189
  $ polyaxon ops pull -a
2211
2190
  """
2212
- owner, _, project_name = get_project_or_local(
2191
+ owner, project_name = get_project_or_local(
2213
2192
  project or ctx.obj.get("project"), is_cli=True
2214
2193
  )
2215
2194
 
@@ -2329,7 +2308,7 @@ def push(ctx, project, uid, all_runs, no_artifacts, clean, path, reset_project):
2329
2308
  \b
2330
2309
  $ polyaxon ops push -uid 8aac02e3a62a4f0aaa257c59da5eab80 --reset-project -p send-to-project
2331
2310
  """
2332
- owner, _, project_name = get_project_or_local(
2311
+ owner, project_name = get_project_or_local(
2333
2312
  project or ctx.obj.get("project"), is_cli=True
2334
2313
  )
2335
2314
 
@@ -12,7 +12,7 @@ from clipped.utils.responses import get_meta_response
12
12
  from clipped.utils.validation import validate_tags
13
13
  from urllib3.exceptions import HTTPError
14
14
 
15
- from polyaxon._cli.dashboard import get_dashboard_url, get_project_subpath_url
15
+ from polyaxon._cli.dashboard import get_dashboard_url
16
16
  from polyaxon._cli.errors import handle_cli_error
17
17
  from polyaxon._contexts.paths import get_offline_base_path
18
18
  from polyaxon._schemas.lifecycle import V1ProjectVersionKind
@@ -170,7 +170,6 @@ def list_project_versions(
170
170
 
171
171
  def register_project_version(
172
172
  owner: str,
173
- team: Optional[str],
174
173
  project_name: str,
175
174
  version: str,
176
175
  kind: V1ProjectVersionKind,
@@ -210,9 +209,7 @@ def register_project_version(
210
209
  Printer.print(
211
210
  "You can view this version on Polyaxon UI: {}".format(
212
211
  get_dashboard_url(
213
- subpath="{}/{}s/{}".format(
214
- get_project_subpath_url(owner, team, project_name), kind, version
215
- )
212
+ subpath="{}/{}/{}s/{}".format(owner, project_name, kind, version)
216
213
  )
217
214
  )
218
215
  )
@@ -220,7 +217,6 @@ def register_project_version(
220
217
 
221
218
  def copy_project_version(
222
219
  owner: str,
223
- team: Optional[str],
224
220
  project_name: str,
225
221
  version: str,
226
222
  kind: V1ProjectVersionKind,
@@ -265,10 +261,8 @@ def copy_project_version(
265
261
  Printer.print(
266
262
  "You can view this version on Polyaxon UI: {}".format(
267
263
  get_dashboard_url(
268
- subpath="{}/{}s/{}".format(
269
- get_project_subpath_url(owner, team, to_project or project_name),
270
- kind,
271
- _version.name,
264
+ subpath="{}/{}/{}s/{}".format(
265
+ owner, to_project or project_name, kind, _version.name
272
266
  )
273
267
  )
274
268
  )
@@ -277,7 +271,6 @@ def copy_project_version(
277
271
 
278
272
  def get_project_version(
279
273
  owner: str,
280
- team: Optional[str],
281
274
  project_name: str,
282
275
  kind: V1ProjectVersionKind,
283
276
  version: str,
@@ -295,17 +288,6 @@ def get_project_version(
295
288
  try:
296
289
  response = polyaxon_client.get_version(kind, version)
297
290
  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
- )
309
291
  except (ApiException, HTTPError) as e:
310
292
  handle_cli_error(
311
293
  e,
@@ -488,16 +470,13 @@ def stage_project_version(
488
470
 
489
471
  def open_project_version_dashboard(
490
472
  owner: str,
491
- team: Optional[str],
492
473
  project_name: str,
493
474
  kind: V1ProjectVersionKind,
494
475
  version: str,
495
476
  url: str,
496
477
  yes: bool = False,
497
478
  ):
498
- subpath = "{}/{}s/{}".format(
499
- get_project_subpath_url(owner, team, project_name), kind, version
500
- )
479
+ subpath = "{}/{}/{}s/{}".format(owner, project_name, kind, version)
501
480
 
502
481
  artifact_url = get_dashboard_url(subpath=subpath)
503
482
  if url:
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, get_project_subpath_url
11
+ from polyaxon._cli.dashboard import get_dashboard_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,7 +19,6 @@ 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
23
22
  from polyaxon.client import ProjectClient, V1Project
24
23
  from polyaxon.exceptions import ApiException
25
24
  from polyaxon.logger import clean_outputs
@@ -75,7 +74,7 @@ def create(ctx, name, description, tags, public, init):
75
74
  command_help="project create",
76
75
  sys_exit=True,
77
76
  )
78
- owner, team, project_name = resolve_entity_info(
77
+ owner, project_name = resolve_entity_info(
79
78
  name or ctx.obj.get("project"), is_cli=True, entity_name="project"
80
79
  )
81
80
 
@@ -91,9 +90,7 @@ def create(ctx, name, description, tags, public, init):
91
90
  project_config = V1Project(
92
91
  name=project_name, description=description, tags=tags, is_public=public
93
92
  )
94
- polyaxon_client = ProjectClient(
95
- owner=get_owner_team_space(owner, team), manual_exceptions_handling=True
96
- )
93
+ polyaxon_client = ProjectClient(owner=owner, manual_exceptions_handling=True)
97
94
  _project = polyaxon_client.create(project_config)
98
95
  config = polyaxon_client.client.sanitize_for_serialization(_project)
99
96
  cache.cache(config_manager=ProjectConfigManager, config=config)
@@ -106,9 +103,7 @@ def create(ctx, name, description, tags, public, init):
106
103
  Printer.success("Project `{}` was created successfully.".format(_project.name))
107
104
  Printer.print(
108
105
  "You can view this project on Polyaxon UI: {}".format(
109
- get_dashboard_url(
110
- subpath=get_project_subpath_url(owner, team, _project.name)
111
- )
106
+ get_dashboard_url(subpath="{}/{}".format(owner, _project.name))
112
107
  )
113
108
  )
114
109
 
@@ -200,7 +195,7 @@ def get(ctx, _project):
200
195
  \b
201
196
  $ polyaxon project get -p owner/project
202
197
  """
203
- owner, team, project_name = get_project_or_local(
198
+ owner, project_name = get_project_or_local(
204
199
  _project or ctx.obj.get("project"), is_cli=True
205
200
  )
206
201
 
@@ -219,13 +214,6 @@ def get(ctx, _project):
219
214
  project=project_name,
220
215
  )
221
216
  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
- )
229
217
  except (ApiException, HTTPError) as e:
230
218
  handle_cli_error(
231
219
  e, message="Could not get project `{}`.".format(project_name), sys_exit=True
@@ -249,7 +237,7 @@ def delete(ctx, _project, yes):
249
237
 
250
238
  Uses /docs/core/cli/#caching
251
239
  """
252
- owner, _, project_name = get_project_or_local(
240
+ owner, project_name = get_project_or_local(
253
241
  _project or ctx.obj.get("project"), is_cli=True
254
242
  )
255
243
 
@@ -312,7 +300,7 @@ def update(ctx, _project, name, description, tags, private):
312
300
  \b
313
301
  $ polyaxon update --tags="foo, bar"
314
302
  """
315
- owner, _, project_name = get_project_or_local(
303
+ owner, project_name = get_project_or_local(
316
304
  _project or ctx.obj.get("project"), is_cli=True
317
305
  )
318
306
 
@@ -369,12 +357,10 @@ def update(ctx, _project, name, description, tags, private):
369
357
  @clean_outputs
370
358
  def dashboard(ctx, _project, yes, url):
371
359
  """Open this project's dashboard details in browser."""
372
- owner, team, project_name = get_project_or_local(
360
+ owner, project_name = get_project_or_local(
373
361
  _project or ctx.obj.get("project"), is_cli=True
374
362
  )
375
- project_url = get_dashboard_url(
376
- subpath=get_project_subpath_url(owner, team, project_name)
377
- )
363
+ project_url = get_dashboard_url(subpath="{}/{}".format(owner, project_name))
378
364
  if url:
379
365
  Printer.header("The dashboard is available at: {}".format(project_url))
380
366
  sys.exit(0)
polyaxon/_cli/run.py CHANGED
@@ -10,11 +10,10 @@ 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, get_project_subpath_url
13
+ from polyaxon._cli.dashboard import get_dashboard_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
18
17
  from polyaxon._cli.operations import logs as run_logs
19
18
  from polyaxon._cli.operations import shell as run_shell
20
19
  from polyaxon._cli.operations import statuses
@@ -31,7 +30,6 @@ from polyaxon._polyaxonfile import check_polyaxonfile
31
30
  from polyaxon._runner.kinds import RunnerKind
32
31
  from polyaxon._schemas.lifecycle import ManagedBy
33
32
  from polyaxon._utils import cache
34
- from polyaxon._utils.fqn_utils import get_owner_team_space
35
33
  from polyaxon.client import RunClient
36
34
  from polyaxon.exceptions import ApiException
37
35
  from polyaxon.logger import clean_outputs
@@ -45,7 +43,6 @@ def _run(
45
43
  ctx,
46
44
  name: str,
47
45
  owner: str,
48
- team: Optional[str],
49
46
  project_name: str,
50
47
  description: str,
51
48
  tags: List[str],
@@ -64,14 +61,11 @@ def _run(
64
61
  owner=owner, project=project_name, manual_exceptions_handling=True
65
62
  )
66
63
 
67
- owner_team = get_owner_team_space(owner, team)
68
- project_url = get_project_subpath_url(owner, team, project_name)
69
-
70
64
  def get_instance_info(r):
71
65
  rn = (
72
66
  f"[white]{r.name}[/white]@[white]{r.uuid}[/white]"
73
67
  if r.name
74
- else f"[white]{r.uuid}[/white]"
68
+ else "[white]{r.uuid}[/white]"
75
69
  )
76
70
  return f"[white]{owner}[/white]/[white]{project_name}[/white]:{rn}"
77
71
 
@@ -99,9 +93,8 @@ def _run(
99
93
  meta_info=meta_info,
100
94
  pending=pending,
101
95
  )
102
- host_kwargs = get_op_agent_host(response.settings)
103
96
  run_url = get_dashboard_url(
104
- subpath="{}/runs/{}".format(project_url, response.uuid), **host_kwargs
97
+ subpath="{}/{}/runs/{}".format(owner, project_name, response.uuid)
105
98
  )
106
99
  if output:
107
100
  response_data = polyaxon_client.client.sanitize_for_serialization(
@@ -132,38 +125,26 @@ def _run(
132
125
 
133
126
  def execute_run_locally(run_uuid: str):
134
127
  ctx.obj = {
135
- "project": "{}/{}".format(owner_team, project_name),
128
+ "project": "{}/{}".format(owner, project_name),
136
129
  "run_uuid": run_uuid,
137
130
  "executor": executor,
138
131
  }
139
132
  ctx.invoke(run_execute)
140
133
 
141
134
  def watch_run_statuses(run_uuid: str):
142
- ctx.obj = {
143
- "project": "{}/{}".format(owner_team, project_name),
144
- "run_uuid": run_uuid,
145
- }
135
+ ctx.obj = {"project": "{}/{}".format(owner, project_name), "run_uuid": run_uuid}
146
136
  ctx.invoke(statuses, watch=True)
147
137
 
148
138
  def watch_run_logs(run_uuid: str):
149
- ctx.obj = {
150
- "project": "{}/{}".format(owner_team, project_name),
151
- "run_uuid": run_uuid,
152
- }
139
+ ctx.obj = {"project": "{}/{}".format(owner, project_name), "run_uuid": run_uuid}
153
140
  ctx.invoke(run_logs)
154
141
 
155
142
  def start_run_shell(run_uuid: str):
156
- ctx.obj = {
157
- "project": "{}/{}".format(owner_team, project_name),
158
- "run_uuid": run_uuid,
159
- }
143
+ ctx.obj = {"project": "{}/{}".format(owner, project_name), "run_uuid": run_uuid}
160
144
  ctx.invoke(run_shell)
161
145
 
162
146
  def upload_run(run_uuid: str):
163
- ctx.obj = {
164
- "project": "{}/{}".format(owner_team, project_name),
165
- "run_uuid": run_uuid,
166
- }
147
+ ctx.obj = {"project": "{}/{}".format(owner, project_name), "run_uuid": run_uuid}
167
148
  ctx.invoke(
168
149
  run_upload, path_to=upload_to, path_from=upload_from, sync_failure=True
169
150
  )
@@ -574,14 +555,13 @@ def run(
574
555
  Printer.print("Please customize the specification or disable the template!")
575
556
  sys.exit(1)
576
557
 
577
- owner, team, project_name = get_project_or_local(project, is_cli=True)
558
+ owner, project_name = get_project_or_local(project, is_cli=True)
578
559
  tags = validate_tags(tags, validate_yaml=True)
579
560
 
580
561
  _run(
581
562
  ctx=ctx,
582
563
  name=name,
583
564
  owner=owner,
584
- team=team,
585
565
  project_name=project_name,
586
566
  description=description,
587
567
  tags=tags,
@@ -12,7 +12,6 @@ from clipped.utils.validation import validate_tags
12
12
 
13
13
  from polyaxon._client.client import PolyaxonClient
14
14
  from polyaxon._client.decorators import client_handler, get_global_or_inline_config
15
- from polyaxon._client.mixin import ClientMixin
16
15
  from polyaxon._constants.globals import DEFAULT
17
16
  from polyaxon._contexts import paths as ctx_paths
18
17
  from polyaxon._env_vars.getters.user import get_local_owner
@@ -22,17 +21,13 @@ from polyaxon._sdk.schemas.v1_list_project_versions_response import (
22
21
  )
23
22
  from polyaxon._sdk.schemas.v1_project import V1Project
24
23
  from polyaxon._sdk.schemas.v1_project_version import V1ProjectVersion
25
- from polyaxon._utils.fqn_utils import (
26
- get_entity_full_name,
27
- get_entity_info,
28
- split_owner_team_space,
29
- )
24
+ from polyaxon._utils.fqn_utils import get_entity_full_name, get_entity_info
30
25
  from polyaxon.exceptions import ApiException, PolyaxonClientException
31
26
  from polyaxon.logger import logger
32
27
  from traceml.artifacts import V1RunArtifact
33
28
 
34
29
 
35
- class ProjectClient(ClientMixin):
30
+ class ProjectClient:
36
31
  """ProjectClient is a client to communicate with Polyaxon projects endpoints.
37
32
 
38
33
  If no values are passed to this class,
@@ -99,13 +94,26 @@ class ProjectClient(ClientMixin):
99
94
  if not owner:
100
95
  raise PolyaxonClientException("Please provide a valid owner.")
101
96
 
102
- owner, team = split_owner_team_space(owner)
103
97
  self._client = client
104
98
  self._owner = owner or DEFAULT
105
- self._team = team
106
99
  self._project = project
107
100
  self._project_data = V1Project.construct()
108
101
 
102
+ @property
103
+ def client(self):
104
+ if self._client:
105
+ return self._client
106
+ self._client = PolyaxonClient()
107
+ return self._client
108
+
109
+ @property
110
+ def owner(self):
111
+ return self._owner
112
+
113
+ @property
114
+ def project(self):
115
+ return self._project
116
+
109
117
  @property
110
118
  def project_data(self):
111
119
  return self._project_data
@@ -131,19 +139,11 @@ class ProjectClient(ClientMixin):
131
139
  Returns:
132
140
  V1Project, project instance from the response.
133
141
  """
134
- if self.team:
135
- self._project_data = self.client.projects_v1.create_team_project(
136
- self.owner,
137
- self.team,
138
- data,
139
- async_req=False,
140
- )
141
- else:
142
- self._project_data = self.client.projects_v1.create_project(
143
- self.owner,
144
- data,
145
- async_req=False,
146
- )
142
+ self._project_data = self.client.projects_v1.create_project(
143
+ self.owner,
144
+ data,
145
+ async_req=False,
146
+ )
147
147
  self._project_data.owner = self.owner
148
148
  self._project = self._project_data.name
149
149
  return self._project_data