예제 #1
0
def sync_get_external_partition_config_grpc(
    api_client, repository_handle, partition_set_name, partition_name
):
    from dagster.grpc.client import DagsterGrpcClient

    check.inst_param(api_client, "api_client", DagsterGrpcClient)
    check.inst_param(repository_handle, "repository_handle", RepositoryHandle)
    check.str_param(partition_set_name, "partition_set_name")
    check.str_param(partition_name, "partition_name")
    repository_origin = repository_handle.get_external_origin()
    result = check.inst(
        deserialize_json_to_dagster_namedtuple(
            api_client.external_partition_config(
                partition_args=PartitionArgs(
                    repository_origin=repository_origin,
                    partition_set_name=partition_set_name,
                    partition_name=partition_name,
                ),
            ),
        ),
        (ExternalPartitionConfigData, ExternalPartitionExecutionErrorData),
    )
    if isinstance(result, ExternalPartitionExecutionErrorData):
        raise DagsterUserCodeProcessError.from_error_info(result.error)

    return result
예제 #2
0
def sync_get_external_partition_tags_grpc(
    api_client: "DagsterGrpcClient",
    repository_handle: RepositoryHandle,
    partition_set_name: str,
    partition_name: str,
) -> ExternalPartitionTagsData:
    from dagster.grpc.client import DagsterGrpcClient

    check.inst_param(api_client, "api_client", DagsterGrpcClient)
    check.inst_param(repository_handle, "repository_handle", RepositoryHandle)
    check.str_param(partition_set_name, "partition_set_name")
    check.str_param(partition_name, "partition_name")

    repository_origin = repository_handle.get_external_origin()
    result = deserialize_as(
        api_client.external_partition_tags(partition_args=PartitionArgs(
            repository_origin=repository_origin,
            partition_set_name=partition_set_name,
            partition_name=partition_name,
        ), ),
        (ExternalPartitionTagsData, ExternalPartitionExecutionErrorData),
    )
    if isinstance(result, ExternalPartitionExecutionErrorData):
        raise DagsterUserCodeProcessError.from_error_info(result.error)

    return result
예제 #3
0
    def get_external_partition_tags(self, repository_handle, partition_set_name, partition_name):
        check.inst_param(repository_handle, 'repository_handle', RepositoryHandle)
        check.str_param(partition_set_name, 'partition_set_name')
        check.str_param(partition_name, 'partition_name')

        args = PartitionArgs(
            repository_origin=repository_handle.get_origin(),
            partition_set_name=partition_set_name,
            partition_name=partition_name,
        )
        return get_partition_tags(args)
예제 #4
0
    def get_external_partition_config(self, repository_handle, partition_set_name, partition_name):
        check.inst_param(repository_handle, "repository_handle", RepositoryHandle)
        check.str_param(partition_set_name, "partition_set_name")
        check.str_param(partition_name, "partition_name")

        args = PartitionArgs(
            repository_origin=repository_handle.get_origin(),
            partition_set_name=partition_set_name,
            partition_name=partition_name,
        )
        return get_partition_config(args)
예제 #5
0
def sync_get_external_partition_config_grpc(api_client, repository_handle,
                                            partition_set_name,
                                            partition_name):
    check.inst_param(api_client, 'api_client', DagsterGrpcClient)
    check.inst_param(repository_handle, 'repository_handle', RepositoryHandle)
    check.str_param(partition_set_name, 'partition_set_name')
    check.str_param(partition_name, 'partition_name')
    repository_origin = repository_handle.get_origin()
    return check.inst(
        api_client.external_partition_config(partition_args=PartitionArgs(
            repository_origin=repository_origin,
            partition_set_name=partition_set_name,
            partition_name=partition_name,
        ), ),
        (ExternalPartitionConfigData, ExternalPartitionExecutionErrorData),
    )
예제 #6
0
def sync_get_external_partition_tags_grpc(api_client, repository_handle,
                                          partition_set_name, partition_name):
    from dagster.grpc.client import DagsterGrpcClient

    check.inst_param(api_client, "api_client", DagsterGrpcClient)
    check.inst_param(repository_handle, "repository_handle", RepositoryHandle)
    check.str_param(partition_set_name, "partition_set_name")
    check.str_param(partition_name, "partition_name")

    repository_origin = repository_handle.get_external_origin()
    return check.inst(
        api_client.external_partition_tags(partition_args=PartitionArgs(
            repository_origin=repository_origin,
            partition_set_name=partition_set_name,
            partition_name=partition_name,
        ), ),
        (ExternalPartitionTagsData, ExternalPartitionExecutionErrorData),
    )
예제 #7
0
def sync_get_external_partition_config(repository_handle, partition_set_name, partition_name):
    check.inst_param(repository_handle, 'repository_handle', RepositoryHandle)
    check.str_param(partition_set_name, 'partition_set_name')
    check.str_param(partition_name, 'partition_name')
    repository_origin = repository_handle.get_origin()

    return check.inst(
        execute_unary_api_cli_command(
            repository_origin.executable_path,
            'partition_config',
            PartitionArgs(
                repository_origin=repository_origin,
                partition_set_name=partition_set_name,
                partition_name=partition_name,
            ),
        ),
        (ExternalPartitionConfigData, ExternalPartitionExecutionErrorData),
    )
예제 #8
0
def sync_get_external_partition_tags(repository_handle, partition_set_name,
                                     partition_name):
    check.inst_param(repository_handle, "repository_handle", RepositoryHandle)
    check.str_param(partition_set_name, "partition_set_name")
    check.str_param(partition_name, "partition_name")
    repository_origin = repository_handle.get_origin()

    return check.inst(
        execute_unary_api_cli_command(
            repository_origin.executable_path,
            "partition_tags",
            PartitionArgs(
                repository_origin=repository_origin,
                partition_set_name=partition_set_name,
                partition_name=partition_name,
            ),
        ),
        (ExternalPartitionTagsData, ExternalPartitionExecutionErrorData),
    )
예제 #9
0
def sync_get_external_partition_config_grpc(repository_handle, partition_set_name, partition_name):
    check.inst_param(repository_handle, 'repository_handle', RepositoryHandle)
    check.str_param(partition_set_name, 'partition_set_name')
    check.str_param(partition_name, 'partition_name')
    repository_origin = repository_handle.get_origin()

    with ephemeral_grpc_api_client(
        python_executable_path=repository_origin.executable_path
    ) as api_client:
        return check.inst(
            api_client.external_partition_config(
                partition_args=PartitionArgs(
                    repository_origin=repository_origin,
                    partition_set_name=partition_set_name,
                    partition_name=partition_name,
                ),
            ),
            (ExternalPartitionConfigData, ExternalPartitionExecutionErrorData),
        )