Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster/dagster/api/snapshot_job.py
- This file was moved from python_modules/dagster/dagster/api/snapshot_executable.py.
from dagster import check | from dagster import check | ||||
from dagster.core.host_representation.external_data import ( | from dagster.core.host_representation.external_data import ( | ||||
ExternalExecutionParamsData, | ExternalExecutionParamsData, | ||||
ExternalExecutionParamsErrorData, | ExternalExecutionParamsErrorData, | ||||
) | ) | ||||
from dagster.core.host_representation.handle import RepositoryHandle | from dagster.core.host_representation.handle import RepositoryHandle | ||||
from dagster.core.types.loadable_target_origin import LoadableTargetOrigin | from dagster.core.types.loadable_target_origin import LoadableTargetOrigin | ||||
from dagster.grpc.types import ExternalExecutableArgs | from dagster.grpc.types import ExternalJobArgs | ||||
from .utils import execute_unary_api_cli_command | from .utils import execute_unary_api_cli_command | ||||
def sync_get_external_executable_params(instance, repository_handle, name): | def sync_get_external_job_params(instance, repository_handle, name): | ||||
check.inst_param(repository_handle, "repository_handle", RepositoryHandle) | check.inst_param(repository_handle, "repository_handle", RepositoryHandle) | ||||
check.str_param(name, "name") | check.str_param(name, "name") | ||||
origin = repository_handle.get_origin() | origin = repository_handle.get_origin() | ||||
return check.inst( | return check.inst( | ||||
execute_unary_api_cli_command( | execute_unary_api_cli_command( | ||||
origin.executable_path, | origin.executable_path, | ||||
"executable_params", | "job_params", | ||||
ExternalExecutableArgs( | ExternalJobArgs(repository_origin=origin, instance_ref=instance.get_ref(), name=name,), | ||||
repository_origin=origin, instance_ref=instance.get_ref(), name=name, | |||||
), | |||||
), | ), | ||||
(ExternalExecutionParamsData, ExternalExecutionParamsErrorData), | (ExternalExecutionParamsData, ExternalExecutionParamsErrorData), | ||||
) | ) | ||||
def sync_get_external_executable_params_ephemeral_grpc(instance, repository_handle, name): | def sync_get_external_job_params_ephemeral_grpc(instance, repository_handle, name): | ||||
from dagster.grpc.client import ephemeral_grpc_api_client | from dagster.grpc.client import ephemeral_grpc_api_client | ||||
origin = repository_handle.get_origin() | origin = repository_handle.get_origin() | ||||
with ephemeral_grpc_api_client( | with ephemeral_grpc_api_client( | ||||
LoadableTargetOrigin(executable_path=origin.executable_path) | LoadableTargetOrigin(executable_path=origin.executable_path) | ||||
) as api_client: | ) as api_client: | ||||
return sync_get_external_executable_params_grpc( | return sync_get_external_job_params_grpc(api_client, instance, repository_handle, name) | ||||
api_client, instance, repository_handle, name | |||||
) | |||||
def sync_get_external_executable_params_grpc(api_client, instance, repository_handle, name): | def sync_get_external_job_params_grpc(api_client, instance, repository_handle, name): | ||||
check.inst_param(repository_handle, "repository_handle", RepositoryHandle) | check.inst_param(repository_handle, "repository_handle", RepositoryHandle) | ||||
check.str_param(name, "name") | check.str_param(name, "name") | ||||
origin = repository_handle.get_origin() | origin = repository_handle.get_origin() | ||||
return check.inst( | return check.inst( | ||||
api_client.external_executable_params( | api_client.external_job_params( | ||||
external_executable_args=ExternalExecutableArgs( | external_job_args=ExternalJobArgs( | ||||
repository_origin=origin, instance_ref=instance.get_ref(), name=name, | repository_origin=origin, instance_ref=instance.get_ref(), name=name, | ||||
) | ) | ||||
), | ), | ||||
(ExternalExecutionParamsData, ExternalExecutionParamsErrorData), | (ExternalExecutionParamsData, ExternalExecutionParamsErrorData), | ||||
) | ) |