polyaxon 2.1.6__py3-none-any.whl → 2.1.7__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/_cli/artifacts.py +81 -0
- polyaxon/_cli/components.py +81 -0
- polyaxon/_cli/models.py +81 -0
- polyaxon/_cli/operations.py +1 -1
- polyaxon/_cli/project_versions.py +113 -1
- polyaxon/_client/project.py +196 -1
- polyaxon/_contexts/paths.py +1 -1
- polyaxon/pkg.py +1 -1
- {polyaxon-2.1.6.dist-info → polyaxon-2.1.7.dist-info}/METADATA +3 -3
- {polyaxon-2.1.6.dist-info → polyaxon-2.1.7.dist-info}/RECORD +14 -14
- {polyaxon-2.1.6.dist-info → polyaxon-2.1.7.dist-info}/LICENSE +0 -0
- {polyaxon-2.1.6.dist-info → polyaxon-2.1.7.dist-info}/WHEEL +0 -0
- {polyaxon-2.1.6.dist-info → polyaxon-2.1.7.dist-info}/entry_points.txt +0 -0
- {polyaxon-2.1.6.dist-info → polyaxon-2.1.7.dist-info}/top_level.txt +0 -0
polyaxon/_cli/artifacts.py
CHANGED
@@ -15,6 +15,7 @@ from polyaxon._cli.project_versions import (
|
|
15
15
|
list_project_versions,
|
16
16
|
open_project_version_dashboard,
|
17
17
|
pull_one_or_many_project_versions,
|
18
|
+
push_one_or_many_project_versions,
|
18
19
|
register_project_version,
|
19
20
|
stage_project_version,
|
20
21
|
transfer_project_version,
|
@@ -547,6 +548,86 @@ def pull(
|
|
547
548
|
)
|
548
549
|
|
549
550
|
|
551
|
+
@artifacts.command()
|
552
|
+
@click.option(*OPTIONS_PROJECT["args"], **OPTIONS_PROJECT["kwargs"])
|
553
|
+
@click.option(*OPTIONS_ARTIFACT_VERSION["args"], **OPTIONS_ARTIFACT_VERSION["kwargs"])
|
554
|
+
@click.option(
|
555
|
+
"--all-versions",
|
556
|
+
"-a",
|
557
|
+
is_flag=True,
|
558
|
+
default=False,
|
559
|
+
help="To push all versions.",
|
560
|
+
)
|
561
|
+
@click.option(
|
562
|
+
"--clean",
|
563
|
+
"-c",
|
564
|
+
is_flag=True,
|
565
|
+
default=False,
|
566
|
+
help="To clean the version(s) local data after syncing.",
|
567
|
+
)
|
568
|
+
@click.option(
|
569
|
+
"--path",
|
570
|
+
"--path-from",
|
571
|
+
type=click.Path(exists=False),
|
572
|
+
help="Optional path where the artifact versions are persisted, "
|
573
|
+
"default value is taken from the env var: `POLYAXON_OFFLINE_ROOT`.",
|
574
|
+
)
|
575
|
+
@click.option(
|
576
|
+
"--reset-project",
|
577
|
+
is_flag=True,
|
578
|
+
default=False,
|
579
|
+
help="Optional, to ignore the owner/project of the local "
|
580
|
+
"version and use the owner/project provided or resolved from the current project.",
|
581
|
+
)
|
582
|
+
@click.option(
|
583
|
+
"--force",
|
584
|
+
is_flag=True,
|
585
|
+
default=False,
|
586
|
+
help="Flag to force register if the version already exists.",
|
587
|
+
)
|
588
|
+
@click.pass_context
|
589
|
+
@clean_outputs
|
590
|
+
def push(
|
591
|
+
ctx,
|
592
|
+
project,
|
593
|
+
version,
|
594
|
+
all_versions,
|
595
|
+
clean,
|
596
|
+
path,
|
597
|
+
reset_project,
|
598
|
+
force,
|
599
|
+
):
|
600
|
+
"""Push local packaged artifact version or multiple artifact versions to a remove server.
|
601
|
+
|
602
|
+
Uses /docs/core/cli/#caching
|
603
|
+
|
604
|
+
Examples:
|
605
|
+
|
606
|
+
\b
|
607
|
+
$ polyaxon artifacts push -ver rc12
|
608
|
+
|
609
|
+
\b
|
610
|
+
$ polyaxon artifacts push -p acme/foobar --path /tmp/versions
|
611
|
+
|
612
|
+
\b
|
613
|
+
$ polyaxon artifacts pull -p acme/foobar -a --path /tmp/versions
|
614
|
+
"""
|
615
|
+
owner, project_name = get_project_or_local(
|
616
|
+
project or ctx.obj.get("project"), is_cli=True
|
617
|
+
)
|
618
|
+
push_one_or_many_project_versions(
|
619
|
+
owner=owner,
|
620
|
+
project_name=project_name,
|
621
|
+
kind=V1ProjectVersionKind.ARTIFACT,
|
622
|
+
version=version,
|
623
|
+
all_versions=all_versions,
|
624
|
+
path=path,
|
625
|
+
clean=clean,
|
626
|
+
force=force,
|
627
|
+
reset_project=reset_project,
|
628
|
+
)
|
629
|
+
|
630
|
+
|
550
631
|
@artifacts.command()
|
551
632
|
@click.option(*OPTIONS_PROJECT["args"], **OPTIONS_PROJECT["kwargs"])
|
552
633
|
@click.option(*OPTIONS_ARTIFACT_VERSION["args"], **OPTIONS_ARTIFACT_VERSION["kwargs"])
|
polyaxon/_cli/components.py
CHANGED
@@ -21,6 +21,7 @@ from polyaxon._cli.project_versions import (
|
|
21
21
|
list_project_versions,
|
22
22
|
open_project_version_dashboard,
|
23
23
|
pull_one_or_many_project_versions,
|
24
|
+
push_one_or_many_project_versions,
|
24
25
|
register_project_version,
|
25
26
|
stage_project_version,
|
26
27
|
transfer_project_version,
|
@@ -576,6 +577,86 @@ def pull(
|
|
576
577
|
)
|
577
578
|
|
578
579
|
|
580
|
+
@components.command()
|
581
|
+
@click.option(*OPTIONS_PROJECT["args"], **OPTIONS_PROJECT["kwargs"])
|
582
|
+
@click.option(*OPTIONS_COMPONENT_VERSION["args"], **OPTIONS_COMPONENT_VERSION["kwargs"])
|
583
|
+
@click.option(
|
584
|
+
"--all-versions",
|
585
|
+
"-a",
|
586
|
+
is_flag=True,
|
587
|
+
default=False,
|
588
|
+
help="To push all versions.",
|
589
|
+
)
|
590
|
+
@click.option(
|
591
|
+
"--clean",
|
592
|
+
"-c",
|
593
|
+
is_flag=True,
|
594
|
+
default=False,
|
595
|
+
help="To clean the version(s) local data after syncing.",
|
596
|
+
)
|
597
|
+
@click.option(
|
598
|
+
"--path",
|
599
|
+
"--path-from",
|
600
|
+
type=click.Path(exists=False),
|
601
|
+
help="Optional path where the component versions are persisted, "
|
602
|
+
"default value is taken from the env var: `POLYAXON_OFFLINE_ROOT`.",
|
603
|
+
)
|
604
|
+
@click.option(
|
605
|
+
"--reset-project",
|
606
|
+
is_flag=True,
|
607
|
+
default=False,
|
608
|
+
help="Optional, to ignore the owner/project of the local "
|
609
|
+
"version and use the owner/project provided or resolved from the current project.",
|
610
|
+
)
|
611
|
+
@click.option(
|
612
|
+
"--force",
|
613
|
+
is_flag=True,
|
614
|
+
default=False,
|
615
|
+
help="Flag to force register if the version already exists.",
|
616
|
+
)
|
617
|
+
@click.pass_context
|
618
|
+
@clean_outputs
|
619
|
+
def push(
|
620
|
+
ctx,
|
621
|
+
project,
|
622
|
+
version,
|
623
|
+
all_versions,
|
624
|
+
clean,
|
625
|
+
path,
|
626
|
+
reset_project,
|
627
|
+
force,
|
628
|
+
):
|
629
|
+
"""Push local packaged component version or multiple component versions to a remove server.
|
630
|
+
|
631
|
+
Uses /docs/core/cli/#caching
|
632
|
+
|
633
|
+
Examples:
|
634
|
+
|
635
|
+
\b
|
636
|
+
$ polyaxon components push -ver rc12
|
637
|
+
|
638
|
+
\b
|
639
|
+
$ polyaxon components push -p acme/foobar --path /tmp/versions
|
640
|
+
|
641
|
+
\b
|
642
|
+
$ polyaxon components pull -p acme/foobar -a --path /tmp/versions
|
643
|
+
"""
|
644
|
+
owner, project_name = get_project_or_local(
|
645
|
+
project or ctx.obj.get("project"), is_cli=True
|
646
|
+
)
|
647
|
+
push_one_or_many_project_versions(
|
648
|
+
owner=owner,
|
649
|
+
project_name=project_name,
|
650
|
+
kind=V1ProjectVersionKind.COMPONENT,
|
651
|
+
version=version,
|
652
|
+
all_versions=all_versions,
|
653
|
+
path=path,
|
654
|
+
clean=clean,
|
655
|
+
force=force,
|
656
|
+
reset_project=reset_project,
|
657
|
+
)
|
658
|
+
|
659
|
+
|
579
660
|
@components.command()
|
580
661
|
@click.option(*OPTIONS_PROJECT["args"], **OPTIONS_PROJECT["kwargs"])
|
581
662
|
@click.option(*OPTIONS_COMPONENT_VERSION["args"], **OPTIONS_COMPONENT_VERSION["kwargs"])
|
polyaxon/_cli/models.py
CHANGED
@@ -11,6 +11,7 @@ from polyaxon._cli.project_versions import (
|
|
11
11
|
list_project_versions,
|
12
12
|
open_project_version_dashboard,
|
13
13
|
pull_one_or_many_project_versions,
|
14
|
+
push_one_or_many_project_versions,
|
14
15
|
register_project_version,
|
15
16
|
stage_project_version,
|
16
17
|
transfer_project_version,
|
@@ -546,6 +547,86 @@ def pull(
|
|
546
547
|
)
|
547
548
|
|
548
549
|
|
550
|
+
@models.command()
|
551
|
+
@click.option(*OPTIONS_PROJECT["args"], **OPTIONS_PROJECT["kwargs"])
|
552
|
+
@click.option(*OPTIONS_MODEL_VERSION["args"], **OPTIONS_MODEL_VERSION["kwargs"])
|
553
|
+
@click.option(
|
554
|
+
"--all-versions",
|
555
|
+
"-a",
|
556
|
+
is_flag=True,
|
557
|
+
default=False,
|
558
|
+
help="To push all versions.",
|
559
|
+
)
|
560
|
+
@click.option(
|
561
|
+
"--clean",
|
562
|
+
"-c",
|
563
|
+
is_flag=True,
|
564
|
+
default=False,
|
565
|
+
help="To clean the version(s) local data after syncing.",
|
566
|
+
)
|
567
|
+
@click.option(
|
568
|
+
"--path",
|
569
|
+
"--path-from",
|
570
|
+
type=click.Path(exists=False),
|
571
|
+
help="Optional path where the model versions are persisted, "
|
572
|
+
"default value is taken from the env var: `POLYAXON_OFFLINE_ROOT`.",
|
573
|
+
)
|
574
|
+
@click.option(
|
575
|
+
"--reset-project",
|
576
|
+
is_flag=True,
|
577
|
+
default=False,
|
578
|
+
help="Optional, to ignore the owner/project of the local "
|
579
|
+
"version and use the owner/project provided or resolved from the current project.",
|
580
|
+
)
|
581
|
+
@click.option(
|
582
|
+
"--force",
|
583
|
+
is_flag=True,
|
584
|
+
default=False,
|
585
|
+
help="Flag to force register if the version already exists.",
|
586
|
+
)
|
587
|
+
@click.pass_context
|
588
|
+
@clean_outputs
|
589
|
+
def push(
|
590
|
+
ctx,
|
591
|
+
project,
|
592
|
+
version,
|
593
|
+
all_versions,
|
594
|
+
clean,
|
595
|
+
path,
|
596
|
+
reset_project,
|
597
|
+
force,
|
598
|
+
):
|
599
|
+
"""Push local packaged model version or multiple model versions to a remove server.
|
600
|
+
|
601
|
+
Uses /docs/core/cli/#caching
|
602
|
+
|
603
|
+
Examples:
|
604
|
+
|
605
|
+
\b
|
606
|
+
$ polyaxon models push -ver rc12
|
607
|
+
|
608
|
+
\b
|
609
|
+
$ polyaxon models push -p acme/foobar --path /tmp/versions
|
610
|
+
|
611
|
+
\b
|
612
|
+
$ polyaxon models pull -p acme/foobar -a --path /tmp/versions
|
613
|
+
"""
|
614
|
+
owner, project_name = get_project_or_local(
|
615
|
+
project or ctx.obj.get("project"), is_cli=True
|
616
|
+
)
|
617
|
+
push_one_or_many_project_versions(
|
618
|
+
owner=owner,
|
619
|
+
project_name=project_name,
|
620
|
+
kind=V1ProjectVersionKind.MODEL,
|
621
|
+
version=version,
|
622
|
+
all_versions=all_versions,
|
623
|
+
path=path,
|
624
|
+
clean=clean,
|
625
|
+
force=force,
|
626
|
+
reset_project=reset_project,
|
627
|
+
)
|
628
|
+
|
629
|
+
|
549
630
|
@models.command()
|
550
631
|
@click.option(*OPTIONS_PROJECT["args"], **OPTIONS_PROJECT["kwargs"])
|
551
632
|
@click.option(*OPTIONS_MODEL_VERSION["args"], **OPTIONS_MODEL_VERSION["kwargs"])
|
polyaxon/_cli/operations.py
CHANGED
@@ -2259,7 +2259,7 @@ def pull(
|
|
2259
2259
|
@click.pass_context
|
2260
2260
|
@clean_outputs
|
2261
2261
|
def push(ctx, project, uid, all_runs, no_artifacts, clean, path, reset_project):
|
2262
|
-
"""Push
|
2262
|
+
"""Push a local run (or all runs) to a remove server.
|
2263
2263
|
|
2264
2264
|
Uses /docs/core/cli/#caching
|
2265
2265
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import os
|
1
2
|
import sys
|
2
3
|
|
3
4
|
from typing import Callable, List, Optional, Union
|
@@ -13,6 +14,7 @@ from urllib3.exceptions import HTTPError
|
|
13
14
|
|
14
15
|
from polyaxon._cli.dashboard import get_dashboard_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
|
@@ -526,7 +528,7 @@ def pull_one_or_many_project_versions(
|
|
526
528
|
owner: str,
|
527
529
|
project_name: str,
|
528
530
|
kind: V1ProjectVersionKind,
|
529
|
-
version: str,
|
531
|
+
version: Optional[str] = None,
|
530
532
|
all_versions: Optional[bool] = None,
|
531
533
|
query: Optional[str] = None,
|
532
534
|
limit: Optional[int] = None,
|
@@ -566,3 +568,113 @@ def pull_one_or_many_project_versions(
|
|
566
568
|
"or pass the flag `-a/--all` to pull versions.",
|
567
569
|
sys_exit=True,
|
568
570
|
)
|
571
|
+
|
572
|
+
|
573
|
+
def push_project_version(
|
574
|
+
owner: str,
|
575
|
+
project_name: str,
|
576
|
+
kind: V1ProjectVersionKind,
|
577
|
+
version: str,
|
578
|
+
path: str,
|
579
|
+
reset_project: bool = False,
|
580
|
+
force: bool = False,
|
581
|
+
clean: bool = False,
|
582
|
+
sys_exit: bool = False,
|
583
|
+
):
|
584
|
+
fqn_version = get_versioned_entity_full_name(owner, project_name, version)
|
585
|
+
polyaxon_client = ProjectClient(
|
586
|
+
owner=owner, project=project_name, manual_exceptions_handling=True
|
587
|
+
)
|
588
|
+
|
589
|
+
try:
|
590
|
+
try:
|
591
|
+
polyaxon_client.load_offline_version(
|
592
|
+
kind=kind,
|
593
|
+
version=version,
|
594
|
+
path=path,
|
595
|
+
project_client=polyaxon_client,
|
596
|
+
reset_project=reset_project,
|
597
|
+
raise_if_not_found=True,
|
598
|
+
)
|
599
|
+
except Exception as _:
|
600
|
+
Printer.error(
|
601
|
+
"Could not load offline version `{}`.".format(version),
|
602
|
+
sys_exit=sys_exit,
|
603
|
+
)
|
604
|
+
return
|
605
|
+
|
606
|
+
Printer.header(
|
607
|
+
"Pushing {} version [white]`{}`[/white] ...".format(kind, fqn_version),
|
608
|
+
)
|
609
|
+
polyaxon_client.push_version(
|
610
|
+
kind,
|
611
|
+
version,
|
612
|
+
path=path,
|
613
|
+
force=force,
|
614
|
+
clean=clean,
|
615
|
+
)
|
616
|
+
Printer.success(
|
617
|
+
"Finished pushing the {} version `{}` from `{}`".format(
|
618
|
+
kind, fqn_version, path
|
619
|
+
)
|
620
|
+
)
|
621
|
+
except (ApiException, HTTPError) as e:
|
622
|
+
handle_cli_error(
|
623
|
+
e,
|
624
|
+
message="Could not push the {} version `{}`".format(kind, fqn_version),
|
625
|
+
)
|
626
|
+
|
627
|
+
|
628
|
+
def push_one_or_many_project_versions(
|
629
|
+
owner: str,
|
630
|
+
project_name: str,
|
631
|
+
kind: V1ProjectVersionKind,
|
632
|
+
path: str,
|
633
|
+
version: Optional[str] = None,
|
634
|
+
all_versions: Optional[bool] = None,
|
635
|
+
reset_project: bool = False,
|
636
|
+
force: bool = False,
|
637
|
+
clean: bool = False,
|
638
|
+
):
|
639
|
+
def _push(version_name: str):
|
640
|
+
push_project_version(
|
641
|
+
owner=owner,
|
642
|
+
project_name=project_name,
|
643
|
+
kind=kind,
|
644
|
+
version=version_name,
|
645
|
+
path=path,
|
646
|
+
reset_project=reset_project,
|
647
|
+
force=force,
|
648
|
+
clean=clean,
|
649
|
+
)
|
650
|
+
|
651
|
+
offline_path = get_offline_base_path(
|
652
|
+
entity_kind=kind,
|
653
|
+
path=path,
|
654
|
+
)
|
655
|
+
|
656
|
+
if all_versions:
|
657
|
+
if (
|
658
|
+
not os.path.exists(offline_path)
|
659
|
+
or not os.path.isdir(offline_path)
|
660
|
+
or not os.listdir(offline_path)
|
661
|
+
):
|
662
|
+
Printer.error(
|
663
|
+
f"Could not push offline {kind} versions, the path `{offline_path}` "
|
664
|
+
f"does not exist, is not a directory, or is empty."
|
665
|
+
)
|
666
|
+
sys.exit(1)
|
667
|
+
version_paths = os.listdir(offline_path)
|
668
|
+
Printer.header(
|
669
|
+
f"Pushing local {kind} versions (total: {len(version_paths)}) ..."
|
670
|
+
)
|
671
|
+
for idx, uid in enumerate(version_paths):
|
672
|
+
Printer.heading(f"Pushing {kind} version {idx + 1}/{len(offline_path)} ...")
|
673
|
+
_push(uid)
|
674
|
+
elif version:
|
675
|
+
_push(version)
|
676
|
+
else:
|
677
|
+
Printer.error(
|
678
|
+
"Please provide a version name, or pass the flag `-a/--all` to pull versions.",
|
679
|
+
sys_exit=True,
|
680
|
+
)
|
polyaxon/_client/project.py
CHANGED
@@ -4,7 +4,7 @@ from datetime import datetime
|
|
4
4
|
from requests import HTTPError
|
5
5
|
from typing import Dict, List, Optional, Tuple, Union
|
6
6
|
|
7
|
-
from clipped.utils.json import orjson_dumps
|
7
|
+
from clipped.utils.json import orjson_dumps, orjson_loads
|
8
8
|
from clipped.utils.paths import check_or_create_path, delete_path
|
9
9
|
from clipped.utils.query_params import get_query_params
|
10
10
|
from clipped.utils.tz import now
|
@@ -727,9 +727,12 @@ class ProjectClient:
|
|
727
727
|
description: Optional[str] = None,
|
728
728
|
tags: Optional[Union[str, List[str]]] = None,
|
729
729
|
content: Optional[Union[str, Dict]] = None,
|
730
|
+
readme: Optional[str] = None,
|
730
731
|
run: Optional[str] = None,
|
731
732
|
connection: Optional[str] = None,
|
732
733
|
artifacts: Optional[List[str]] = None,
|
734
|
+
stage: Optional[V1Stages] = None,
|
735
|
+
stage_conditions: Optional[List[V1StageCondition]] = None,
|
733
736
|
force: bool = False,
|
734
737
|
) -> V1ProjectVersion:
|
735
738
|
"""Creates or Updates a project version based on the data passed.
|
@@ -745,9 +748,12 @@ class ProjectClient:
|
|
745
748
|
description: str, optional, the version description.
|
746
749
|
tags: str or List[str], optional.
|
747
750
|
content: str or dict, optional, content/metadata (JSON object) of the version.
|
751
|
+
readme: str, optional, the version readme.
|
748
752
|
run: str, optional, a uuid reference to the run.
|
749
753
|
connection: str, optional, a uuid reference to a connection.
|
750
754
|
artifacts: List[str], optional, list of artifacts to highlight(requires passing a run)
|
755
|
+
stage: V1Stages, optional, the version stage.
|
756
|
+
stage_conditions: List[V1StageCondition], optional, the version stage conditions.
|
751
757
|
force: bool, optional, to force push, i.e. update if exists.
|
752
758
|
|
753
759
|
Returns:
|
@@ -783,12 +789,18 @@ class ProjectClient:
|
|
783
789
|
version_config.tags = tags
|
784
790
|
if content:
|
785
791
|
version_config.content = content # type: ignore
|
792
|
+
if readme is not None:
|
793
|
+
version_config.readme = readme
|
786
794
|
if run:
|
787
795
|
version_config.run = run
|
788
796
|
if artifacts is not None:
|
789
797
|
version_config.artifacts = artifacts
|
790
798
|
if connection is not None:
|
791
799
|
version_config.connection = connection
|
800
|
+
if stage is not None:
|
801
|
+
version_config.stage = stage
|
802
|
+
if stage_conditions is not None:
|
803
|
+
version_config.stage_conditions = stage_conditions
|
792
804
|
return self.patch_version(
|
793
805
|
kind=kind,
|
794
806
|
version=version,
|
@@ -800,9 +812,12 @@ class ProjectClient:
|
|
800
812
|
description=description,
|
801
813
|
tags=tags,
|
802
814
|
run=run,
|
815
|
+
readme=readme,
|
803
816
|
artifacts=artifacts,
|
804
817
|
connection=connection,
|
805
818
|
content=content,
|
819
|
+
stage=stage,
|
820
|
+
stage_conditions=stage_conditions,
|
806
821
|
)
|
807
822
|
return self.create_version(kind=kind, data=version_config)
|
808
823
|
|
@@ -1575,3 +1590,183 @@ class ProjectClient:
|
|
1575
1590
|
path=path,
|
1576
1591
|
download_artifacts=download_artifacts,
|
1577
1592
|
)
|
1593
|
+
|
1594
|
+
@classmethod
|
1595
|
+
@client_handler(check_no_op=True)
|
1596
|
+
def load_offline_version(
|
1597
|
+
cls,
|
1598
|
+
kind: V1ProjectVersionKind,
|
1599
|
+
version: str,
|
1600
|
+
path: str,
|
1601
|
+
project_client: Optional["ProjectClient"] = None,
|
1602
|
+
reset_project: bool = False,
|
1603
|
+
raise_if_not_found: bool = False,
|
1604
|
+
) -> Optional["ProjectClient"]:
|
1605
|
+
"""Loads a project version from a local path.
|
1606
|
+
|
1607
|
+
Args:
|
1608
|
+
kind: V1ProjectVersionKind, kind of the project version.
|
1609
|
+
version: str, required, the version name/tag.
|
1610
|
+
path: str, local path where to load the version's metadata and artifacts from.
|
1611
|
+
project_client: ProjectClient, optional,
|
1612
|
+
a project client to update with the loaded version.
|
1613
|
+
reset_project: bool, optional, to reset the project client with the loaded version.
|
1614
|
+
raise_if_not_found: bool, optional, to raise an exception if the version is not found.
|
1615
|
+
|
1616
|
+
Returns:
|
1617
|
+
ProjectClient, a project client with the loaded version.
|
1618
|
+
"""
|
1619
|
+
path = ctx_paths.get_offline_path(
|
1620
|
+
entity_value=version, entity_kind=kind, path=path
|
1621
|
+
)
|
1622
|
+
version_path = "{}/{}".format(path, ctx_paths.CONTEXT_LOCAL_VERSION)
|
1623
|
+
if not os.path.exists(version_path):
|
1624
|
+
if raise_if_not_found:
|
1625
|
+
raise PolyaxonClientException(
|
1626
|
+
"Version not found in the provided path: {}".format(path)
|
1627
|
+
)
|
1628
|
+
else:
|
1629
|
+
logger.info(f"Offline data was not found: {version_path}")
|
1630
|
+
return None
|
1631
|
+
|
1632
|
+
with open(version_path, "r") as config_file:
|
1633
|
+
config_str = config_file.read()
|
1634
|
+
version_config = V1ProjectVersion(**orjson_loads(config_str))
|
1635
|
+
owner = version_config.owner
|
1636
|
+
project = version_config.project
|
1637
|
+
if project_client:
|
1638
|
+
if reset_project or not owner:
|
1639
|
+
owner = project_client.owner
|
1640
|
+
if reset_project or not project:
|
1641
|
+
project = project_client.project
|
1642
|
+
project_client._owner = owner
|
1643
|
+
project_client._project = project
|
1644
|
+
else:
|
1645
|
+
project_client = cls(
|
1646
|
+
owner=owner,
|
1647
|
+
project=project,
|
1648
|
+
)
|
1649
|
+
logger.info("Loaded version `{}`".format(version_path))
|
1650
|
+
|
1651
|
+
return project_client
|
1652
|
+
|
1653
|
+
@client_handler(check_no_op=True, check_offline=True)
|
1654
|
+
def push_version(
|
1655
|
+
self,
|
1656
|
+
kind: V1ProjectVersionKind,
|
1657
|
+
version: str,
|
1658
|
+
path: str,
|
1659
|
+
force: bool = False,
|
1660
|
+
clean: bool = False,
|
1661
|
+
):
|
1662
|
+
"""Pushes a local version from a local path to Polyaxon's API.
|
1663
|
+
|
1664
|
+
This is a generic function based on the kind passed and pushes a:
|
1665
|
+
* component version
|
1666
|
+
* model version
|
1667
|
+
* artifact version
|
1668
|
+
|
1669
|
+
Args:
|
1670
|
+
kind: V1ProjectVersionKind, kind of the project version.
|
1671
|
+
version: str, required, the version name/tag.
|
1672
|
+
path: str, optional, defaults to the offline root path,
|
1673
|
+
path where to load the metadata and artifacts from.
|
1674
|
+
force: bool, optional, to force push, i.e. update if exists.
|
1675
|
+
clean: bool, optional, to clean the version after pushing.
|
1676
|
+
"""
|
1677
|
+
path = ctx_paths.get_offline_path(
|
1678
|
+
entity_value=version, entity_kind=kind, path=path
|
1679
|
+
)
|
1680
|
+
version_path = "{}/{}".format(path, ctx_paths.CONTEXT_LOCAL_VERSION)
|
1681
|
+
with open(version_path, "r") as config_file:
|
1682
|
+
config_str = config_file.read()
|
1683
|
+
version_config = V1ProjectVersion(**orjson_loads(config_str))
|
1684
|
+
|
1685
|
+
self.register_version(
|
1686
|
+
kind=kind,
|
1687
|
+
version=version,
|
1688
|
+
description=version_config.description,
|
1689
|
+
tags=version_config.tags,
|
1690
|
+
content=version_config.content,
|
1691
|
+
readme=version_config.readme,
|
1692
|
+
run=version_config.run,
|
1693
|
+
stage=version_config.stage,
|
1694
|
+
stage_conditions=version_config.stage_conditions,
|
1695
|
+
connection=version_config.connection,
|
1696
|
+
artifacts=version_config.artifacts,
|
1697
|
+
force=force,
|
1698
|
+
)
|
1699
|
+
if clean:
|
1700
|
+
delete_path(path)
|
1701
|
+
|
1702
|
+
@client_handler(check_no_op=True, check_offline=True)
|
1703
|
+
def push_component_version(
|
1704
|
+
self,
|
1705
|
+
version: str,
|
1706
|
+
path: str,
|
1707
|
+
force: bool = False,
|
1708
|
+
clean: bool = False,
|
1709
|
+
):
|
1710
|
+
"""Pushes a local component version to a remove server.
|
1711
|
+
|
1712
|
+
Args:
|
1713
|
+
version: str, required, the version name/tag.
|
1714
|
+
path: str, local path where to load the metadata and artifacts from.
|
1715
|
+
force: bool, optional, to force push, i.e. update if exists.
|
1716
|
+
clean: bool, optional, to clean the version after pushing.
|
1717
|
+
"""
|
1718
|
+
return self.push_version(
|
1719
|
+
kind=V1ProjectVersionKind.COMPONENT,
|
1720
|
+
version=version,
|
1721
|
+
path=path,
|
1722
|
+
force=force,
|
1723
|
+
clean=clean,
|
1724
|
+
)
|
1725
|
+
|
1726
|
+
@client_handler(check_no_op=True, check_offline=True)
|
1727
|
+
def push_model_version(
|
1728
|
+
self,
|
1729
|
+
version: str,
|
1730
|
+
path: str,
|
1731
|
+
force: bool = True,
|
1732
|
+
clean: bool = False,
|
1733
|
+
):
|
1734
|
+
"""Pushes a local model version to a remove server.
|
1735
|
+
|
1736
|
+
Args:
|
1737
|
+
version: str, required, the version name/tag.
|
1738
|
+
path: str, local path where to load the metadata and artifacts from.
|
1739
|
+
force: bool, optional, to force push, i.e. update if exists.
|
1740
|
+
clean: bool, optional, to clean the version after pushing.
|
1741
|
+
"""
|
1742
|
+
return self.pull_version(
|
1743
|
+
kind=V1ProjectVersionKind.MODEL,
|
1744
|
+
version=version,
|
1745
|
+
path=path,
|
1746
|
+
force=force,
|
1747
|
+
clean=clean,
|
1748
|
+
)
|
1749
|
+
|
1750
|
+
@client_handler(check_no_op=True, check_offline=True)
|
1751
|
+
def push_artifact_version(
|
1752
|
+
self,
|
1753
|
+
version: str,
|
1754
|
+
path: str,
|
1755
|
+
force: bool = True,
|
1756
|
+
clean: bool = False,
|
1757
|
+
):
|
1758
|
+
"""Pushes a local artifact version to a remote server.
|
1759
|
+
|
1760
|
+
Args:
|
1761
|
+
version: str, required, the version name/tag.
|
1762
|
+
path: str, local path where to load the metadata and artifacts from.
|
1763
|
+
force: bool, optional, to force push, i.e. update if exists.
|
1764
|
+
clean: bool, optional, to clean the version after pushing.
|
1765
|
+
"""
|
1766
|
+
return self.pull_version(
|
1767
|
+
kind=V1ProjectVersionKind.ARTIFACT,
|
1768
|
+
version=version,
|
1769
|
+
path=path,
|
1770
|
+
force=force,
|
1771
|
+
clean=clean,
|
1772
|
+
)
|
polyaxon/_contexts/paths.py
CHANGED
@@ -18,7 +18,7 @@ CONTEXT_RELATED_RUNS = "_related_runs"
|
|
18
18
|
CONTEXT_LOCAL_LINEAGES = "lineages.plx.json"
|
19
19
|
CONTEXT_LOCAL_CONTENT = "content.plx.json"
|
20
20
|
CONTEXT_LOCAL_README = "readme.plx.md"
|
21
|
-
CONTEXT_LOCAL_POLYAXONFILE = "polyaxonfile.plx.
|
21
|
+
CONTEXT_LOCAL_POLYAXONFILE = "polyaxonfile.plx.json"
|
22
22
|
CONTEXT_LOCAL_PROJECT = "project.plx.json"
|
23
23
|
CONTEXT_LOCAL_RUN = "run.plx.json"
|
24
24
|
CONTEXT_LOCAL_VERSION = "version.plx.json"
|
polyaxon/pkg.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: polyaxon
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.7
|
4
4
|
Summary: Command Line Interface (CLI) and client to interact with Polyaxon API.
|
5
5
|
Home-page: https://github.com/polyaxon/polyaxon
|
6
6
|
Author: Polyaxon, Inc.
|
@@ -59,7 +59,7 @@ Requires-Dist: moto ==2.0.5 ; extra == 'dev'
|
|
59
59
|
Provides-Extra: docker
|
60
60
|
Requires-Dist: docker ; extra == 'docker'
|
61
61
|
Provides-Extra: fs
|
62
|
-
Requires-Dist: adlfs ==2024.
|
62
|
+
Requires-Dist: adlfs ==2024.4.0 ; extra == 'fs'
|
63
63
|
Requires-Dist: fsspec ==2024.3.1 ; extra == 'fs'
|
64
64
|
Requires-Dist: gcsfs ==2024.3.1 ; extra == 'fs'
|
65
65
|
Requires-Dist: s3fs ==2024.3.1 ; extra == 'fs'
|
@@ -93,7 +93,7 @@ Requires-Dist: anyio ; extra == 'sidecar'
|
|
93
93
|
[](https://polyaxon.com/slack/)
|
94
94
|
|
95
95
|
[](https://polyaxon.com/docs/)
|
96
|
-
[](https://polyaxon.com/docs/releases/2-1/)
|
97
97
|
[](https://github.com/polyaxon/polyaxon/issues)
|
98
98
|
[](https://github.com/orgs/polyaxon/projects/5)
|
99
99
|
|
@@ -9,7 +9,7 @@ polyaxon/exceptions.py,sha256=ujvG9p1Pn2KHYbHqB3-faadW46dEuULUQXNtfkd2zk8,10236
|
|
9
9
|
polyaxon/fs.py,sha256=RS8XmVrrfXfIJXN6cTCCRRYwesCLHVVfC01Vi56lecs,246
|
10
10
|
polyaxon/k8s.py,sha256=nI5oPCSlqU4aaeVShM6SlYS9eqYiYUL4GDXIZ4bnq-I,1051
|
11
11
|
polyaxon/logger.py,sha256=gdZQms37Pe5G2j-Ear5jbSAJeGgX6fnvg7oE8_9MSlc,2309
|
12
|
-
polyaxon/pkg.py,sha256=
|
12
|
+
polyaxon/pkg.py,sha256=ByBvNDbYjXlOpomyY76_SbHSy3mkYr2DlJVPP1jzd-E,262
|
13
13
|
polyaxon/polyaxonfile.py,sha256=xHmHT_cHomfuAQm82Jhnp71YNN5mQ-Lod7EbonjY4b4,429
|
14
14
|
polyaxon/schemas.py,sha256=-CykY3emoAUCs_zRNbjwkuMkqbaEDjfKsZC86rI8154,5870
|
15
15
|
polyaxon/settings.py,sha256=Pxx1-T2oeJ5XmvGFN0YgnVzum_9FyTPaQtl68aQvYc4,4116
|
@@ -23,20 +23,20 @@ polyaxon/_auxiliaries/sidecar.py,sha256=XqAPteBHlSZbXPn_HKBEA5ar2IfcNANqfhe8lHrt
|
|
23
23
|
polyaxon/_auxiliaries/tuner.py,sha256=W27fyK5PDwTSv3z-0nmvmw_dUM3UIoV5JCCNeK9CIKw,941
|
24
24
|
polyaxon/_cli/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
25
25
|
polyaxon/_cli/admin.py,sha256=xvnQyLKwqyxIzBV7_Xv59Z95-AAxU_h3qdu9UMg8AkE,8872
|
26
|
-
polyaxon/_cli/artifacts.py,sha256=
|
26
|
+
polyaxon/_cli/artifacts.py,sha256=wyexlRictltdRlhGj0nu-UjUd9XD2UQcBSN0TP934cA,18350
|
27
27
|
polyaxon/_cli/auth.py,sha256=Ytvw3ik6_LiSICfZu6Qw5IM95Df7eelOeRFD-tu8EUE,5002
|
28
28
|
polyaxon/_cli/check.py,sha256=WSQpQp3enPmgIXrllwgUTd3VcjYCG8P-37ONt7F67wo,1337
|
29
29
|
polyaxon/_cli/completion.py,sha256=soJlrKTAFdxskWNH3YjgCMTM__NqVCr9Rr6z8FSmXao,2017
|
30
|
-
polyaxon/_cli/components.py,sha256=
|
30
|
+
polyaxon/_cli/components.py,sha256=h4lot3iD_uLeT85-iR1dVaDNshleKvwzaSJ5SFdVDXM,19694
|
31
31
|
polyaxon/_cli/config.py,sha256=popMLIN_wYCMEY9S5N5NepiyTn9-oYf0TALtsb8cTX8,8278
|
32
32
|
polyaxon/_cli/dashboard.py,sha256=PrBVmxrT4GdsqXLWNDVysmYUIjUcixfYC7EM2LurQAI,1374
|
33
33
|
polyaxon/_cli/errors.py,sha256=BYs7-I0CLLNYma-I0eJXB1EHs8ZTs_nWGRKGJz6CzTI,1031
|
34
34
|
polyaxon/_cli/init.py,sha256=vpi-fI_kK4bWldC1WtmrUp-N6AQ_LPSpaQkRfpqyGCk,7711
|
35
|
-
polyaxon/_cli/models.py,sha256=
|
36
|
-
polyaxon/_cli/operations.py,sha256=
|
35
|
+
polyaxon/_cli/models.py,sha256=yyd5T-oJ_rxTAEiZNjiX-uCYh3R3JdxR1EJYQYdxeSU,17942
|
36
|
+
polyaxon/_cli/operations.py,sha256=l9HoDR22FJbcLG1wk-3Cu0d3ge7OVl04c9DC1Lw0NzY,74093
|
37
37
|
polyaxon/_cli/options.py,sha256=-jeMZsdfg0JOV_QzVDf1hAhqK55NI0dkC_x4MZZWty8,1927
|
38
38
|
polyaxon/_cli/port_forward.py,sha256=Lshpcrv7-4tXcriHmppiFW_3QZ7ZosDtUbJDIvdddSA,2733
|
39
|
-
polyaxon/_cli/project_versions.py,sha256=
|
39
|
+
polyaxon/_cli/project_versions.py,sha256=aAwWuNsFTqH7mzofGMcomLqKcVGSfvbfX6VGryP2poE,19829
|
40
40
|
polyaxon/_cli/projects.py,sha256=CtjGSXUjUhvhKOdOJAWxS5r-5PpHeqgXbB6_F7wEZb8,11591
|
41
41
|
polyaxon/_cli/run.py,sha256=11j7_EGhMOB0dRGjczW_ldr251WSyPZqD7Qi61AnHys,17194
|
42
42
|
polyaxon/_cli/session.py,sha256=5Plolpxwkv3wiup0pRYBpBPD64dvb4GzeRPz_nuIGRo,6033
|
@@ -55,7 +55,7 @@ polyaxon/_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
55
55
|
polyaxon/_client/client.py,sha256=wLRAkm05qNi-rc5RpkWic3oJZNF0HTxkrtOOkbB0YqE,8015
|
56
56
|
polyaxon/_client/impersonate.py,sha256=4jRoJoX8nkwvVc3zAYqVqPoysNT1kZoPRbwyTpyHGHw,1260
|
57
57
|
polyaxon/_client/init.py,sha256=QECGjzuBTFaagndubzd9U1COpc5NGe-E0aVkSRetcIs,418
|
58
|
-
polyaxon/_client/project.py,sha256=
|
58
|
+
polyaxon/_client/project.py,sha256=Vw-Ve09Hw5h93-OJzSv6K7Z8eiCy6RHA-Jb6Ft7flkE,65375
|
59
59
|
polyaxon/_client/run.py,sha256=GV5s4e4HOw7p46QhOngkbiNfAtjzMW-EFShQs_QzU-E,118286
|
60
60
|
polyaxon/_client/store.py,sha256=-Y33ypkijGQnhHTQ_vCTqLlpk0wRqoaP-ntJhdUtv7E,11311
|
61
61
|
polyaxon/_client/decorators/__init__.py,sha256=e5CBijciLP-Ic-YkaL4tFhUdr--uod_TexvxAJamGZQ,186
|
@@ -114,7 +114,7 @@ polyaxon/_containers/statuses.py,sha256=Ac-AqBEStg0R_lFUF6l7dL7Pxnn1qgywLWJio9JL
|
|
114
114
|
polyaxon/_contexts/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
115
115
|
polyaxon/_contexts/keys.py,sha256=7NnqmYFmOhiD_ovep_sJKl2ZcH7OfByhtiIvTirDfX8,709
|
116
116
|
polyaxon/_contexts/params.py,sha256=eqxmgMEQR2flL0WiziOHPo314S7vqFBrig3s9hMK_vM,293
|
117
|
-
polyaxon/_contexts/paths.py,sha256=
|
117
|
+
polyaxon/_contexts/paths.py,sha256=VenEQwumkRPSDYchrNPU0PsBLkOHy1CLFOQKCv3oCyE,3644
|
118
118
|
polyaxon/_contexts/refs.py,sha256=qtxG6QgawTpH9Ckaq-RK6UcB0ZyDBy8YqRieugOmnF0,3426
|
119
119
|
polyaxon/_contexts/sections.py,sha256=eSMc6NflcVtvSUFd8VqqzNxdqdbJ6lVFcwGY8CudIX0,771
|
120
120
|
polyaxon/_deploy/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
@@ -594,9 +594,9 @@ polyaxon/tuners/hyperopt.py,sha256=zd6MblMGkooqLGDFJVo5kClqYnBoMwGj-opqqj8FDzQ,7
|
|
594
594
|
polyaxon/tuners/mapping.py,sha256=pOdHCiwEufTk-QT7pNyjBjAEWNTM-lMC17WNTCk7C24,69
|
595
595
|
polyaxon/tuners/random_search.py,sha256=6VEekM3N9h6E1lbpVTTUGKFPJlGMY2u-GkG615_nQcI,80
|
596
596
|
polyaxon_sdk/__init__.py,sha256=HWvFdGWESyVG3f26K_szewiG-McMOHFkXKTfZcBlHsM,92
|
597
|
-
polyaxon-2.1.
|
598
|
-
polyaxon-2.1.
|
599
|
-
polyaxon-2.1.
|
600
|
-
polyaxon-2.1.
|
601
|
-
polyaxon-2.1.
|
602
|
-
polyaxon-2.1.
|
597
|
+
polyaxon-2.1.7.dist-info/LICENSE,sha256=86kroZbQUDsmSWOomB7dpceG65UXiVSPob4581tStBc,11349
|
598
|
+
polyaxon-2.1.7.dist-info/METADATA,sha256=xnDAXPfpehL2k0W-w9_EdC0DfTWdrxvFqDzfhlIwnyg,11709
|
599
|
+
polyaxon-2.1.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
600
|
+
polyaxon-2.1.7.dist-info/entry_points.txt,sha256=aFbUMjkg9vzRBVAFhqvR1m92yG8Cov7UAF0zViGfoQw,70
|
601
|
+
polyaxon-2.1.7.dist-info/top_level.txt,sha256=I_2e_Vv8rdcqWcMMdZocbrHiKPNGqoSMBqIObrw00Rg,22
|
602
|
+
polyaxon-2.1.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|