polyaxon 2.0.0rc27__py3-none-any.whl → 2.0.0rc29__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/api.py +4 -0
- polyaxon/auxiliaries/default_scheduling.py +1 -1
- polyaxon/auxiliaries/init.py +1 -1
- polyaxon/auxiliaries/sidecar.py +1 -1
- polyaxon/cli/operations.py +18 -2
- polyaxon/cli/services/docker.py +1 -1
- polyaxon/cli/services/initializer.py +1 -1
- polyaxon/client/run.py +23 -26
- polyaxon/compiler/contexts/contexts.py +0 -2
- polyaxon/compiler/contexts/service.py +14 -9
- polyaxon/compiler/resolver/agent.py +1 -1
- polyaxon/compiler/resolver/runtime.py +0 -1
- polyaxon/constants/metadata.py +1 -0
- polyaxon/deploy/schemas/auth.py +1 -1
- polyaxon/deploy/schemas/celery.py +1 -1
- polyaxon/deploy/schemas/deployment.py +7 -1
- polyaxon/deploy/schemas/email.py +1 -1
- polyaxon/deploy/schemas/ingress.py +1 -1
- polyaxon/deploy/schemas/intervals.py +1 -1
- polyaxon/deploy/schemas/operators.py +0 -1
- polyaxon/deploy/schemas/proxy.py +1 -1
- polyaxon/deploy/schemas/root_user.py +1 -1
- polyaxon/deploy/schemas/security_context.py +1 -1
- polyaxon/deploy/schemas/service.py +1 -1
- polyaxon/deploy/schemas/ssl.py +1 -1
- polyaxon/deploy/schemas/ui.py +1 -1
- polyaxon/docker/docker_types.py +1 -1
- polyaxon/env_vars/keys.py +0 -2
- polyaxon/k8s/converter/converters/__init__.py +0 -2
- polyaxon/k8s/converter/converters/dask_job.py +3 -0
- polyaxon/k8s/converter/mixins.py +0 -7
- polyaxon/k8s/custom_resources/dask_job.py +14 -2
- polyaxon/lifecycle.py +1 -1
- polyaxon/pkg.py +1 -1
- polyaxon/polyflow/__init__.py +0 -4
- polyaxon/polyflow/builds/__init__.py +1 -1
- polyaxon/polyflow/cache/__init__.py +1 -1
- polyaxon/polyflow/component/base.py +1 -1
- polyaxon/polyflow/component/component.py +1 -2
- polyaxon/polyflow/component/component_reference.py +1 -1
- polyaxon/polyflow/early_stopping/__init__.py +1 -1
- polyaxon/polyflow/early_stopping/policies.py +1 -1
- polyaxon/polyflow/environment/__init__.py +1 -1
- polyaxon/polyflow/events/__init__.py +1 -1
- polyaxon/polyflow/hooks/__init__.py +1 -1
- polyaxon/polyflow/init/__init__.py +1 -1
- polyaxon/polyflow/io/io.py +1 -1
- polyaxon/polyflow/joins/__init__.py +1 -1
- polyaxon/polyflow/matrix/__init__.py +1 -1
- polyaxon/polyflow/matrix/bayes.py +7 -1
- polyaxon/polyflow/matrix/grid_search.py +1 -1
- polyaxon/polyflow/matrix/hyperband.py +1 -1
- polyaxon/polyflow/matrix/hyperopt.py +1 -1
- polyaxon/polyflow/matrix/iterative.py +1 -1
- polyaxon/polyflow/matrix/mapping.py +1 -1
- polyaxon/polyflow/matrix/params.py +2 -2
- polyaxon/polyflow/matrix/random_search.py +1 -1
- polyaxon/polyflow/matrix/tuner.py +1 -1
- polyaxon/polyflow/mounts/artifacts_mounts.py +1 -1
- polyaxon/polyflow/notifications/__init__.py +1 -1
- polyaxon/polyflow/operations/base.py +1 -1
- polyaxon/polyflow/operations/operation.py +1 -2
- polyaxon/polyflow/optimization/__init__.py +1 -1
- polyaxon/polyflow/params/params.py +1 -1
- polyaxon/polyflow/plugins/__init__.py +1 -1
- polyaxon/polyflow/references/dag.py +1 -1
- polyaxon/polyflow/references/hub.py +1 -1
- polyaxon/polyflow/references/path.py +1 -1
- polyaxon/polyflow/references/url.py +1 -1
- polyaxon/polyflow/run/__init__.py +1 -13
- polyaxon/polyflow/run/dag.py +7 -1
- polyaxon/polyflow/run/dask/replica.py +1 -1
- polyaxon/polyflow/run/job.py +1 -1
- polyaxon/polyflow/run/kinds.py +14 -1
- polyaxon/polyflow/run/kubeflow/mpi_job.py +1 -1
- polyaxon/polyflow/run/kubeflow/mx_job.py +1 -1
- polyaxon/polyflow/run/kubeflow/paddle_job.py +1 -1
- polyaxon/polyflow/run/kubeflow/pytorch_job.py +1 -1
- polyaxon/polyflow/run/kubeflow/replica.py +1 -1
- polyaxon/polyflow/run/kubeflow/scheduling_policy.py +1 -1
- polyaxon/polyflow/run/kubeflow/tf_job.py +1 -1
- polyaxon/polyflow/run/kubeflow/xgboost_job.py +1 -1
- polyaxon/polyflow/run/patch.py +1 -7
- polyaxon/polyflow/run/ray/ray.py +1 -1
- polyaxon/polyflow/run/ray/replica.py +1 -1
- polyaxon/polyflow/run/resources.py +1 -1
- polyaxon/polyflow/run/service.py +1 -1
- polyaxon/polyflow/schedules/__init__.py +1 -1
- polyaxon/polyflow/schedules/cron.py +1 -1
- polyaxon/polyflow/schedules/datetime.py +1 -1
- polyaxon/polyflow/schedules/interval.py +1 -1
- polyaxon/polyflow/templates/__init__.py +1 -1
- polyaxon/polyflow/termination/__init__.py +2 -2
- polyaxon/schemas/api/authentication.py +1 -1
- polyaxon/schemas/api/home.py +1 -1
- polyaxon/schemas/api/installation.py +1 -1
- polyaxon/schemas/api/log_handler.py +1 -1
- polyaxon/schemas/api/resources.py +1 -1
- polyaxon/schemas/api/user.py +1 -1
- polyaxon/schemas/api/version.py +1 -1
- polyaxon/schemas/base.py +1 -1
- polyaxon/schemas/cli/agent_config.py +1 -1
- polyaxon/schemas/cli/cli_config.py +1 -1
- polyaxon/schemas/cli/client_config.py +1 -1
- polyaxon/schemas/responses/v1_activity.py +1 -1
- polyaxon/schemas/responses/v1_agent.py +1 -1
- polyaxon/schemas/responses/v1_agent_status_body_request.py +1 -1
- polyaxon/schemas/responses/v1_analytics_spec.py +1 -1
- polyaxon/schemas/responses/v1_artifact_tree.py +1 -1
- polyaxon/schemas/responses/v1_auth.py +1 -1
- polyaxon/schemas/responses/v1_cloning.py +1 -1
- polyaxon/schemas/responses/v1_connection_response.py +1 -1
- polyaxon/schemas/responses/v1_dashboard.py +1 -1
- polyaxon/schemas/responses/v1_entities_tags.py +1 -1
- polyaxon/schemas/responses/v1_entities_transfer.py +1 -1
- polyaxon/schemas/responses/v1_entity_notification_body.py +1 -1
- polyaxon/schemas/responses/v1_entity_stage_body_request.py +1 -1
- polyaxon/schemas/responses/v1_entity_status_body_request.py +1 -1
- polyaxon/schemas/responses/v1_list_activities_response.py +1 -1
- polyaxon/schemas/responses/v1_list_agents_response.py +1 -1
- polyaxon/schemas/responses/v1_list_bookmarks_response.py +1 -1
- polyaxon/schemas/responses/v1_list_connections_response.py +1 -1
- polyaxon/schemas/responses/v1_list_dashboards_response.py +1 -1
- polyaxon/schemas/responses/v1_list_organization_members_response.py +1 -1
- polyaxon/schemas/responses/v1_list_organizations_response.py +1 -1
- polyaxon/schemas/responses/v1_list_presets_response.py +1 -1
- polyaxon/schemas/responses/v1_list_project_versions_response.py +1 -1
- polyaxon/schemas/responses/v1_list_projects_response.py +1 -1
- polyaxon/schemas/responses/v1_list_queues_response.py +1 -1
- polyaxon/schemas/responses/v1_list_run_artifacts_response.py +1 -1
- polyaxon/schemas/responses/v1_list_run_connections_response.py +1 -1
- polyaxon/schemas/responses/v1_list_run_edges_response.py +1 -1
- polyaxon/schemas/responses/v1_list_runs_response.py +1 -1
- polyaxon/schemas/responses/v1_list_searches_response.py +1 -1
- polyaxon/schemas/responses/v1_list_service_accounts_response.py +1 -1
- polyaxon/schemas/responses/v1_list_tags_response.py +1 -1
- polyaxon/schemas/responses/v1_list_team_members_response.py +1 -1
- polyaxon/schemas/responses/v1_list_teams_response.py +1 -1
- polyaxon/schemas/responses/v1_list_token_response.py +1 -1
- polyaxon/schemas/responses/v1_operation_body.py +1 -1
- polyaxon/schemas/responses/v1_organization.py +1 -1
- polyaxon/schemas/responses/v1_organization_member.py +1 -1
- polyaxon/schemas/responses/v1_password_change.py +1 -1
- polyaxon/schemas/responses/v1_pipeline.py +1 -1
- polyaxon/schemas/responses/v1_preset.py +1 -1
- polyaxon/schemas/responses/v1_project.py +1 -1
- polyaxon/schemas/responses/v1_project_settings.py +1 -1
- polyaxon/schemas/responses/v1_project_user_access.py +1 -1
- polyaxon/schemas/responses/v1_project_version.py +1 -1
- polyaxon/schemas/responses/v1_queue.py +1 -1
- polyaxon/schemas/responses/v1_run.py +1 -1
- polyaxon/schemas/responses/v1_run_connection.py +1 -1
- polyaxon/schemas/responses/v1_run_reference_catalog.py +1 -1
- polyaxon/schemas/responses/v1_run_settings.py +1 -1
- polyaxon/schemas/responses/v1_search.py +1 -1
- polyaxon/schemas/responses/v1_search_spec.py +1 -1
- polyaxon/schemas/responses/v1_section_spec.py +1 -1
- polyaxon/schemas/responses/v1_service_account.py +1 -1
- polyaxon/schemas/responses/v1_settings_catalog.py +2 -1
- polyaxon/schemas/responses/v1_tag.py +1 -1
- polyaxon/schemas/responses/v1_team.py +1 -1
- polyaxon/schemas/responses/v1_team_member.py +1 -1
- polyaxon/schemas/responses/v1_token.py +1 -1
- polyaxon/schemas/responses/v1_trial_start.py +1 -1
- polyaxon/schemas/responses/v1_user.py +1 -1
- polyaxon/schemas/responses/v1_user_singup.py +1 -1
- polyaxon/schemas/services.py +1 -1
- polyaxon/schemas/types/artifacts.py +1 -1
- polyaxon/schemas/types/dockerfile.py +1 -1
- polyaxon/schemas/types/event.py +1 -1
- polyaxon/schemas/types/file.py +1 -1
- polyaxon/schemas/types/git.py +1 -1
- polyaxon/schemas/types/tensorboard.py +1 -1
- polyaxon/sdk/api/agents_v1_api.py +1 -1
- polyaxon/sdk/api/artifacts_stores_v1_api.py +1 -1
- polyaxon/sdk/api/auth_v1_api.py +1 -1
- polyaxon/sdk/api/connections_v1_api.py +1 -1
- polyaxon/sdk/api/dashboards_v1_api.py +1 -1
- polyaxon/sdk/api/organizations_v1_api.py +1 -1
- polyaxon/sdk/api/presets_v1_api.py +1 -1
- polyaxon/sdk/api/project_dashboards_v1_api.py +1 -1
- polyaxon/sdk/api/project_searches_v1_api.py +1 -1
- polyaxon/sdk/api/projects_v1_api.py +1 -1
- polyaxon/sdk/api/queues_v1_api.py +1 -1
- polyaxon/sdk/api/runs_v1_api.py +88 -10
- polyaxon/sdk/api/searches_v1_api.py +1 -1
- polyaxon/sdk/api/service_accounts_v1_api.py +1 -1
- polyaxon/sdk/api/tags_v1_api.py +1 -1
- polyaxon/sdk/api/teams_v1_api.py +1 -1
- polyaxon/sdk/api/users_v1_api.py +1 -1
- polyaxon/sdk/api/versions_v1_api.py +1 -1
- polyaxon/settings.py +1 -1
- polyaxon/utils/urls_utils.py +3 -1
- {polyaxon-2.0.0rc27.dist-info → polyaxon-2.0.0rc29.dist-info}/METADATA +31 -31
- {polyaxon-2.0.0rc27.dist-info → polyaxon-2.0.0rc29.dist-info}/RECORD +199 -205
- {polyaxon-2.0.0rc27.dist-info → polyaxon-2.0.0rc29.dist-info}/WHEEL +1 -1
- polyaxon/compiler/contexts/spark_job.py +0 -39
- polyaxon/k8s/converter/converters/spark_job.py +0 -64
- polyaxon/k8s/custom_resources/spark_job.py +0 -97
- polyaxon/polyflow/run/spark/__init__.py +0 -2
- polyaxon/polyflow/run/spark/replica.py +0 -165
- polyaxon/polyflow/run/spark/spark.py +0 -341
- {polyaxon-2.0.0rc27.dist-info → polyaxon-2.0.0rc29.dist-info}/LICENSE +0 -0
- {polyaxon-2.0.0rc27.dist-info → polyaxon-2.0.0rc29.dist-info}/entry_points.txt +0 -0
- {polyaxon-2.0.0rc27.dist-info → polyaxon-2.0.0rc29.dist-info}/top_level.txt +0 -0
@@ -1,39 +0,0 @@
|
|
1
|
-
import copy
|
2
|
-
|
3
|
-
from typing import Dict, Optional
|
4
|
-
|
5
|
-
from polyaxon.compiler.contexts.base import BaseContextsManager
|
6
|
-
from polyaxon.connections import V1Connection
|
7
|
-
from polyaxon.polyflow import V1CompiledOperation, V1SparkJob, V1SparkReplica
|
8
|
-
|
9
|
-
|
10
|
-
class SparkJobContextsManager(BaseContextsManager):
|
11
|
-
@classmethod
|
12
|
-
def resolve(
|
13
|
-
cls,
|
14
|
-
namespace: str,
|
15
|
-
owner_name: str,
|
16
|
-
project_name: str,
|
17
|
-
run_uuid: str,
|
18
|
-
contexts: Dict,
|
19
|
-
compiled_operation: V1CompiledOperation,
|
20
|
-
connection_by_names: Dict[str, V1Connection],
|
21
|
-
) -> Dict:
|
22
|
-
contexts["init"] = {}
|
23
|
-
contexts["connections"] = {}
|
24
|
-
job = compiled_operation.run # type: V1SparkJob
|
25
|
-
|
26
|
-
def _get_replica(replica: Optional[V1SparkReplica]) -> Dict:
|
27
|
-
if not replica:
|
28
|
-
return contexts
|
29
|
-
return cls._resolver_replica(
|
30
|
-
contexts={"globals": copy.copy(contexts["globals"])},
|
31
|
-
init=replica.init,
|
32
|
-
connections=replica.connections,
|
33
|
-
connection_by_names=connection_by_names,
|
34
|
-
)
|
35
|
-
|
36
|
-
return {
|
37
|
-
"executor": _get_replica(job.executor),
|
38
|
-
"driver": _get_replica(job.driver),
|
39
|
-
}
|
@@ -1,64 +0,0 @@
|
|
1
|
-
from typing import Dict, Iterable, Optional
|
2
|
-
|
3
|
-
from polyaxon import pkg
|
4
|
-
from polyaxon.connections import V1Connection, V1ConnectionResource
|
5
|
-
from polyaxon.k8s.converter.base import BaseConverter
|
6
|
-
from polyaxon.k8s.converter.mixins import SparkJobMixin
|
7
|
-
from polyaxon.k8s.custom_resources.spark_job import get_spark_job_custom_resource
|
8
|
-
from polyaxon.k8s.replica import ReplicaSpec
|
9
|
-
from polyaxon.polyflow import V1CompiledOperation, V1Plugins, V1SparkJob, V1SparkReplica
|
10
|
-
|
11
|
-
|
12
|
-
class SparkJobConverter(SparkJobMixin, BaseConverter):
|
13
|
-
def get_resource(
|
14
|
-
self,
|
15
|
-
compiled_operation: V1CompiledOperation,
|
16
|
-
artifacts_store: V1Connection,
|
17
|
-
connection_by_names: Dict[str, V1Connection],
|
18
|
-
secrets: Optional[Iterable[V1ConnectionResource]],
|
19
|
-
config_maps: Optional[Iterable[V1ConnectionResource]],
|
20
|
-
default_sa: Optional[str] = None,
|
21
|
-
default_auth: bool = False,
|
22
|
-
) -> Dict:
|
23
|
-
job = compiled_operation.run # type: V1SparkJob
|
24
|
-
|
25
|
-
def _get_replica(replica: Optional[V1SparkReplica]) -> Optional[ReplicaSpec]:
|
26
|
-
if not replica:
|
27
|
-
return None
|
28
|
-
return self.get_replica_resource(
|
29
|
-
plugins=plugins,
|
30
|
-
environment=replica.environment,
|
31
|
-
volumes=job.volumes or [],
|
32
|
-
init=replica.init or [],
|
33
|
-
sidecars=replica.sidecars or [],
|
34
|
-
container=replica.container,
|
35
|
-
artifacts_store=artifacts_store,
|
36
|
-
connections=job.connections or [],
|
37
|
-
connection_by_names=connection_by_names,
|
38
|
-
secrets=secrets,
|
39
|
-
config_maps=config_maps,
|
40
|
-
kv_env_vars=kv_env_vars,
|
41
|
-
default_sa=default_sa,
|
42
|
-
num_replicas=replica.replicas,
|
43
|
-
)
|
44
|
-
|
45
|
-
kv_env_vars = compiled_operation.get_env_io()
|
46
|
-
plugins = V1Plugins.get_or_create(
|
47
|
-
config=compiled_operation.plugins, auth=default_auth
|
48
|
-
)
|
49
|
-
executor = _get_replica(job.executor)
|
50
|
-
driver = _get_replica(job.driver)
|
51
|
-
labels = self.get_labels(version=pkg.VERSION, labels={})
|
52
|
-
|
53
|
-
return get_spark_job_custom_resource(
|
54
|
-
namespace=self.namespace,
|
55
|
-
resource_name=self.resource_name,
|
56
|
-
executor=executor,
|
57
|
-
driver=driver,
|
58
|
-
termination=compiled_operation.termination,
|
59
|
-
collect_logs=plugins.collect_logs,
|
60
|
-
sync_statuses=plugins.sync_statuses,
|
61
|
-
notifications=plugins.notifications,
|
62
|
-
labels=labels,
|
63
|
-
annotations=self.annotations,
|
64
|
-
)
|
@@ -1,97 +0,0 @@
|
|
1
|
-
from typing import Dict, List, Optional
|
2
|
-
|
3
|
-
from polyaxon.k8s.converter.pod.spec import get_pod_spec, get_pod_template_spec
|
4
|
-
from polyaxon.k8s.custom_resources.operation import get_operation_custom_object
|
5
|
-
from polyaxon.k8s.custom_resources.setter import (
|
6
|
-
set_collect_logs,
|
7
|
-
set_notify,
|
8
|
-
set_sync_statuses,
|
9
|
-
set_termination,
|
10
|
-
)
|
11
|
-
from polyaxon.k8s.replica import ReplicaSpec
|
12
|
-
from polyaxon.polyflow import V1Notification, V1Termination
|
13
|
-
|
14
|
-
|
15
|
-
def get_spark_replicas_template(
|
16
|
-
namespace: str,
|
17
|
-
resource_name: str,
|
18
|
-
replica_name: str,
|
19
|
-
replica: Optional[ReplicaSpec],
|
20
|
-
labels: Dict[str, str],
|
21
|
-
annotations: Dict[str, str],
|
22
|
-
template_spec: Dict,
|
23
|
-
):
|
24
|
-
if not replica:
|
25
|
-
return
|
26
|
-
|
27
|
-
metadata, pod_spec = get_pod_spec(
|
28
|
-
namespace=namespace,
|
29
|
-
main_container=replica.main_container,
|
30
|
-
sidecar_containers=replica.sidecar_containers,
|
31
|
-
init_containers=replica.init_containers,
|
32
|
-
resource_name=resource_name,
|
33
|
-
volumes=replica.volumes,
|
34
|
-
environment=replica.environment,
|
35
|
-
labels=labels,
|
36
|
-
annotations=annotations,
|
37
|
-
)
|
38
|
-
|
39
|
-
template_spec[replica_name] = {
|
40
|
-
"replicas": replica.num_replicas,
|
41
|
-
"restartPolicy": pod_spec.restart_policy or "Never",
|
42
|
-
"template": get_pod_template_spec(metadata=metadata, pod_spec=pod_spec),
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
|
-
def get_spark_job_custom_resource(
|
47
|
-
resource_name: str,
|
48
|
-
namespace: str,
|
49
|
-
executor: Optional[ReplicaSpec],
|
50
|
-
driver: Optional[ReplicaSpec],
|
51
|
-
termination: V1Termination,
|
52
|
-
collect_logs: bool,
|
53
|
-
sync_statuses: bool,
|
54
|
-
notifications: List[V1Notification],
|
55
|
-
labels: Dict[str, str],
|
56
|
-
annotations: Dict[str, str],
|
57
|
-
) -> Dict:
|
58
|
-
template_spec = {}
|
59
|
-
|
60
|
-
get_spark_replicas_template(
|
61
|
-
replica_name="Executor",
|
62
|
-
replica=executor,
|
63
|
-
namespace=namespace,
|
64
|
-
resource_name=resource_name,
|
65
|
-
labels=labels,
|
66
|
-
annotations=annotations,
|
67
|
-
template_spec=template_spec,
|
68
|
-
)
|
69
|
-
get_spark_replicas_template(
|
70
|
-
replica_name="Driver",
|
71
|
-
replica=driver,
|
72
|
-
namespace=namespace,
|
73
|
-
resource_name=resource_name,
|
74
|
-
labels=labels,
|
75
|
-
annotations=annotations,
|
76
|
-
template_spec=template_spec,
|
77
|
-
)
|
78
|
-
template_spec = {"replicaSpecs": template_spec}
|
79
|
-
custom_object = {"sparkJobSpec": template_spec}
|
80
|
-
custom_object = set_termination(
|
81
|
-
custom_object=custom_object, termination=termination
|
82
|
-
)
|
83
|
-
custom_object = set_collect_logs(
|
84
|
-
custom_object=custom_object, collect_logs=collect_logs
|
85
|
-
)
|
86
|
-
custom_object = set_sync_statuses(
|
87
|
-
custom_object=custom_object, sync_statuses=sync_statuses
|
88
|
-
)
|
89
|
-
custom_object = set_notify(custom_object=custom_object, notifications=notifications)
|
90
|
-
|
91
|
-
return get_operation_custom_object(
|
92
|
-
namespace=namespace,
|
93
|
-
resource_name=resource_name,
|
94
|
-
labels=labels,
|
95
|
-
annotations=annotations,
|
96
|
-
custom_object=custom_object,
|
97
|
-
)
|
@@ -1,165 +0,0 @@
|
|
1
|
-
from typing import List, Optional, Union
|
2
|
-
|
3
|
-
from clipped.types.ref_or_obj import IntOrRef, RefField
|
4
|
-
from pydantic import validator
|
5
|
-
|
6
|
-
from polyaxon.k8s import k8s_schemas, k8s_validation
|
7
|
-
from polyaxon.polyflow.environment import V1Environment
|
8
|
-
from polyaxon.polyflow.init import V1Init
|
9
|
-
from polyaxon.schemas.base import BaseSchemaModel
|
10
|
-
|
11
|
-
|
12
|
-
class V1SparkReplica(BaseSchemaModel):
|
13
|
-
"""Spark replica is the specification for a Spark executor or driver.
|
14
|
-
|
15
|
-
Args:
|
16
|
-
replicas: str, int
|
17
|
-
environment: [V1Environment](/docs/core/specification/environment/), optional
|
18
|
-
init: List[[V1Init](/docs/core/specification/init/)], optional
|
19
|
-
sidecars: List[[sidecar containers](/docs/core/specification/sidecars/)], optional
|
20
|
-
container: [Kubernetes Container](https://kubernetes.io/docs/concepts/containers/)
|
21
|
-
|
22
|
-
## YAML usage
|
23
|
-
|
24
|
-
```yaml
|
25
|
-
>>> executor/driver:
|
26
|
-
>>> replicas:
|
27
|
-
>>> environment:
|
28
|
-
>>> init:
|
29
|
-
>>> sidecars:
|
30
|
-
>>> container:
|
31
|
-
```
|
32
|
-
|
33
|
-
## Python usage
|
34
|
-
|
35
|
-
```python
|
36
|
-
>>> from polyaxon.polyflow import V1Environment, V1Init, V1SparkReplica
|
37
|
-
>>> from polyaxon.k8s import k8s_schemas
|
38
|
-
>>> replica = V1SparkReplica(
|
39
|
-
>>> replicas=2,
|
40
|
-
>>> environment=V1Environment(...),
|
41
|
-
>>> init=[V1Init(...)],
|
42
|
-
>>> sidecars=[k8s_schemas.V1Container(...)],
|
43
|
-
>>> container=k8s_schemas.V1Container(...),
|
44
|
-
>>> )
|
45
|
-
```
|
46
|
-
|
47
|
-
## Fields
|
48
|
-
|
49
|
-
### replicas
|
50
|
-
|
51
|
-
The number of replica (executor/driver) instances.
|
52
|
-
|
53
|
-
```yaml
|
54
|
-
>>> executor:
|
55
|
-
>>> replicas: 2
|
56
|
-
```
|
57
|
-
|
58
|
-
### environment
|
59
|
-
|
60
|
-
Optional [environment section](/docs/core/specification/environment/),
|
61
|
-
it provides a way to inject pod related information into the replica (executor/driver).
|
62
|
-
|
63
|
-
```yaml
|
64
|
-
>>> driver:
|
65
|
-
>>> environment:
|
66
|
-
>>> labels:
|
67
|
-
>>> key1: "label1"
|
68
|
-
>>> key2: "label2"
|
69
|
-
>>> annotations:
|
70
|
-
>>> key1: "value1"
|
71
|
-
>>> key2: "value2"
|
72
|
-
>>> nodeSelector:
|
73
|
-
>>> node_label: node_value
|
74
|
-
>>> ...
|
75
|
-
>>> ...
|
76
|
-
```
|
77
|
-
|
78
|
-
### init
|
79
|
-
|
80
|
-
A list of [init handlers and containers](/docs/core/specification/init/)
|
81
|
-
to resolve for the replica (executor/driver).
|
82
|
-
|
83
|
-
<blockquote class="light">
|
84
|
-
If you are referencing a connection it must be configured.
|
85
|
-
All referenced connections will be checked:
|
86
|
-
|
87
|
-
* If they are accessible in the context of the project of this run
|
88
|
-
|
89
|
-
* If the user running the operation can have access to those connections
|
90
|
-
</blockquote>
|
91
|
-
|
92
|
-
```yaml
|
93
|
-
>>> executor:
|
94
|
-
>>> init:
|
95
|
-
>>> - artifacts:
|
96
|
-
>>> dirs: ["path/on/the/default/artifacts/store"]
|
97
|
-
>>> - connection: gcs-large-datasets
|
98
|
-
>>> artifacts:
|
99
|
-
>>> dirs: ["data"]
|
100
|
-
>>> container:
|
101
|
-
>>> resources:
|
102
|
-
>>> requests:
|
103
|
-
>>> memory: "256Mi"
|
104
|
-
>>> cpu: "500m"
|
105
|
-
>>> - container:
|
106
|
-
>>> name: myapp-container
|
107
|
-
>>> image: busybox:1.28
|
108
|
-
>>> command: ['sh', '-c', 'echo custom init container']
|
109
|
-
```
|
110
|
-
|
111
|
-
### sidecars
|
112
|
-
|
113
|
-
|
114
|
-
A list of [sidecar containers](/docs/core/specification/sidecars/)
|
115
|
-
that will be used as sidecars.
|
116
|
-
|
117
|
-
```yaml
|
118
|
-
>>> driver:
|
119
|
-
>>> sidecars:
|
120
|
-
>>> - name: sidecar2
|
121
|
-
>>> image: busybox:1.28
|
122
|
-
>>> command: ['sh', '-c', 'echo sidecar2']
|
123
|
-
>>> - name: sidecar1
|
124
|
-
>>> image: busybox:1.28
|
125
|
-
>>> command: ['sh', '-c', 'echo sidecar1']
|
126
|
-
>>> resources:
|
127
|
-
>>> requests:
|
128
|
-
>>> memory: "128Mi"
|
129
|
-
>>> cpu: "500m"
|
130
|
-
```
|
131
|
-
|
132
|
-
### container
|
133
|
-
|
134
|
-
The [main Kubernetes Container](https://kubernetes.io/docs/concepts/containers/)
|
135
|
-
that will run your experiment training or data processing
|
136
|
-
logic for the replica (executor/driver).
|
137
|
-
|
138
|
-
```yaml
|
139
|
-
>>> executor:
|
140
|
-
>>> init:
|
141
|
-
>>> - connection: my-code-repo
|
142
|
-
>>> container:
|
143
|
-
>>> name: tensorflow:2.1
|
144
|
-
>>> command: ["python", "/plx-context/artifacts/my-code-repo/model.py"]
|
145
|
-
```
|
146
|
-
"""
|
147
|
-
|
148
|
-
_IDENTIFIER = "replica"
|
149
|
-
_SWAGGER_FIELDS = ["sidecars", "container"]
|
150
|
-
|
151
|
-
replicas: Optional[IntOrRef]
|
152
|
-
environment: Optional[Union[V1Environment, RefField]]
|
153
|
-
init: Optional[Union[List[V1Init], RefField]]
|
154
|
-
sidecars: Optional[Union[List[k8s_schemas.V1Container], RefField]]
|
155
|
-
container: Optional[Union[k8s_schemas.V1Container, RefField]]
|
156
|
-
|
157
|
-
@validator("sidecars", always=True, pre=True)
|
158
|
-
def validate_helper_containers(cls, v):
|
159
|
-
if not v:
|
160
|
-
return v
|
161
|
-
return [k8s_validation.validate_k8s_container(vi) for vi in v]
|
162
|
-
|
163
|
-
@validator("container", always=True, pre=True)
|
164
|
-
def validate_container(cls, v):
|
165
|
-
return k8s_validation.validate_k8s_container(v)
|