コード例 #1
0
def sync_get_external_schedule_execution_data_grpc(
    api_client: "DagsterGrpcClient",
    instance: DagsterInstance,
    repository_handle: RepositoryHandle,
    schedule_name: str,
    scheduled_execution_time: Any,
) -> ScheduleExecutionData:
    check.inst_param(repository_handle, "repository_handle", RepositoryHandle)
    check.str_param(schedule_name, "schedule_name")
    check.opt_inst_param(scheduled_execution_time, "scheduled_execution_time",
                         PendulumDateTime)

    origin = repository_handle.get_external_origin()
    result = deserialize_as(
        api_client.external_schedule_execution(
            external_schedule_execution_args=ExternalScheduleExecutionArgs(
                repository_origin=origin,
                instance_ref=instance.get_ref(),
                schedule_name=schedule_name,
                scheduled_execution_timestamp=scheduled_execution_time.
                timestamp() if scheduled_execution_time else None,
                scheduled_execution_timezone=scheduled_execution_time.timezone.
                name if scheduled_execution_time else None,
            )),
        (ScheduleExecutionData, ExternalScheduleExecutionErrorData),
    )
    if isinstance(result, ExternalScheduleExecutionErrorData):
        raise DagsterUserCodeProcessError.from_error_info(result.error)

    return result
コード例 #2
0
def sync_get_external_schedule_execution_data_grpc(
    api_client,
    instance,
    repository_handle,
    schedule_name,
    scheduled_execution_time,
):
    check.inst_param(repository_handle, "repository_handle", RepositoryHandle)
    check.str_param(schedule_name, "schedule_name")
    check.opt_inst_param(scheduled_execution_time, "scheduled_execution_time",
                         pendulum.Pendulum)

    origin = repository_handle.get_external_origin()

    return check.inst(
        api_client.external_schedule_execution(
            external_schedule_execution_args=ExternalScheduleExecutionArgs(
                repository_origin=origin,
                instance_ref=instance.get_ref(),
                schedule_name=schedule_name,
                scheduled_execution_timestamp=scheduled_execution_time.
                timestamp() if scheduled_execution_time else None,
                scheduled_execution_timezone=scheduled_execution_time.timezone.
                name if scheduled_execution_time else None,
            )),
        (ExternalScheduleExecutionData, ExternalScheduleExecutionErrorData),
    )
コード例 #3
0
    def get_external_schedule_execution_data(
        self,
        instance,
        repository_handle,
        schedule_name,
        schedule_execution_data_mode,
        scheduled_execution_datetime_utc,
    ):
        check.inst_param(instance, "instance", DagsterInstance)
        check.inst_param(repository_handle, "repository_handle",
                         RepositoryHandle)
        check.str_param(schedule_name, "schedule_name")
        check.inst_param(schedule_execution_data_mode,
                         "schedule_execution_data_mode",
                         ScheduleExecutionDataMode)
        check.opt_inst_param(scheduled_execution_datetime_utc,
                             "scheduled_execution_datetime_utc", datetime)

        repo_origin = repository_handle.get_origin()
        args = ExternalScheduleExecutionArgs(
            instance_ref=instance.get_ref(),
            repository_origin=repo_origin,
            schedule_name=schedule_name,
            scheduled_execution_timestamp_utc=(get_timestamp_from_utc_datetime(
                scheduled_execution_datetime_utc) if
                                               scheduled_execution_datetime_utc
                                               else None),
            schedule_execution_data_mode=schedule_execution_data_mode,
        )
        recon_repo = recon_repository_from_origin(repo_origin)
        return get_external_schedule_execution(recon_repo, args)
コード例 #4
0
def sync_get_external_schedule_execution_data(
    instance,
    repository_handle,
    schedule_name,
    schedule_execution_data_mode,
    scheduled_execution_time,
):

    check.inst_param(repository_handle, "repository_handle", RepositoryHandle)
    check.str_param(schedule_name, "schedule_name")
    check.opt_inst_param(scheduled_execution_time, "scheduled_execution_time",
                         pendulum.Pendulum)
    check.inst_param(schedule_execution_data_mode,
                     "schedule_execution_data_mode", ScheduleExecutionDataMode)

    origin = repository_handle.get_origin()

    return check.inst(
        execute_unary_api_cli_command(
            origin.executable_path,
            "schedule_config",
            ExternalScheduleExecutionArgs(
                repository_origin=origin,
                instance_ref=instance.get_ref(),
                schedule_name=schedule_name,
                schedule_execution_data_mode=schedule_execution_data_mode,
                scheduled_execution_timestamp=scheduled_execution_time.
                timestamp() if scheduled_execution_time else None,
                scheduled_execution_timezone=scheduled_execution_time.timezone.
                name if scheduled_execution_time else None,
            ),
        ),
        (ExternalScheduleExecutionData, ExternalScheduleExecutionErrorData),
    )
コード例 #5
0
def sync_get_external_schedule_execution_data_grpc(
    api_client,
    instance,
    repository_handle,
    schedule_name,
    schedule_execution_data_mode,
    scheduled_execution_datetime_utc,
):
    check.inst_param(repository_handle, "repository_handle", RepositoryHandle)
    check.str_param(schedule_name, "schedule_name")
    check.opt_inst_param(
        scheduled_execution_datetime_utc, "scheduled_execution_datetime_utc", datetime
    )
    check.inst_param(
        schedule_execution_data_mode, "schedule_execution_data_mode", ScheduleExecutionDataMode
    )

    origin = repository_handle.get_origin()

    return check.inst(
        api_client.external_schedule_execution(
            external_schedule_execution_args=ExternalScheduleExecutionArgs(
                repository_origin=origin,
                instance_ref=instance.get_ref(),
                schedule_name=schedule_name,
                scheduled_execution_timestamp_utc=(
                    get_timestamp_from_utc_datetime(scheduled_execution_datetime_utc)
                    if scheduled_execution_datetime_utc
                    else None
                ),
                schedule_execution_data_mode=schedule_execution_data_mode,
            )
        ),
        (ExternalScheduleExecutionData, ExternalScheduleExecutionErrorData),
    )
コード例 #6
0
    def get_external_schedule_execution_data(
        self,
        instance,
        repository_handle,
        schedule_name,
        schedule_execution_data_mode,
        scheduled_execution_time,
    ):
        check.inst_param(instance, "instance", DagsterInstance)
        check.inst_param(repository_handle, "repository_handle", RepositoryHandle)
        check.str_param(schedule_name, "schedule_name")
        check.inst_param(
            schedule_execution_data_mode, "schedule_execution_data_mode", ScheduleExecutionDataMode
        )
        check.opt_inst_param(
            scheduled_execution_time, "scheduled_execution_time", pendulum.Pendulum
        )

        repo_origin = repository_handle.get_origin()
        args = ExternalScheduleExecutionArgs(
            instance_ref=instance.get_ref(),
            repository_origin=repo_origin,
            schedule_name=schedule_name,
            schedule_execution_data_mode=schedule_execution_data_mode,
            scheduled_execution_timestamp=scheduled_execution_time.timestamp()
            if scheduled_execution_time
            else None,
            scheduled_execution_timezone=scheduled_execution_time.timezone.name
            if scheduled_execution_time
            else None,
        )
        recon_repo = recon_repository_from_origin(repo_origin)
        return get_external_schedule_execution(recon_repo, args)
コード例 #7
0
    def get_external_schedule_execution_data(self, instance, repository_handle, schedule_name):
        check.inst_param(instance, 'instance', DagsterInstance)
        check.inst_param(repository_handle, 'repository_handle', RepositoryHandle)
        check.str_param(schedule_name, 'schedule_name')

        args = ExternalScheduleExecutionArgs(
            instance_ref=instance.get_ref(),
            repository_origin=repository_handle.get_origin(),
            schedule_name=schedule_name,
        )
        return get_external_schedule_execution(args)
コード例 #8
0
ファイル: snapshot_schedule.py プロジェクト: zuodh/dagster
def sync_get_external_schedule_execution_data_grpc(
    api_client, instance, repository_handle, schedule_name
):
    check.inst_param(repository_handle, 'repository_handle', RepositoryHandle)
    check.str_param(schedule_name, 'schedule_name')

    origin = repository_handle.get_origin()

    return check.inst(
        api_client.external_schedule_execution(
            external_schedule_execution_args=ExternalScheduleExecutionArgs(
                repository_origin=origin,
                instance_ref=instance.get_ref(),
                schedule_name=schedule_name,
            )
        ),
        (ExternalScheduleExecutionData, ExternalScheduleExecutionErrorData),
    )
コード例 #9
0
ファイル: snapshot_schedule.py プロジェクト: zuodh/dagster
def sync_get_external_schedule_execution_data(instance, repository_handle, schedule_name):

    check.inst_param(repository_handle, 'repository_handle', RepositoryHandle)
    check.str_param(schedule_name, 'schedule_name')

    origin = repository_handle.get_origin()

    return check.inst(
        execute_unary_api_cli_command(
            origin.executable_path,
            'schedule_config',
            ExternalScheduleExecutionArgs(
                repository_origin=origin,
                instance_ref=instance.get_ref(),
                schedule_name=schedule_name,
            ),
        ),
        (ExternalScheduleExecutionData, ExternalScheduleExecutionErrorData),
    )
コード例 #10
0
    def get_external_schedule_execution_data(self, instance, repository_handle,
                                             schedule_name,
                                             schedule_execution_data_mode):
        check.inst_param(instance, "instance", DagsterInstance)
        check.inst_param(repository_handle, "repository_handle",
                         RepositoryHandle)
        check.str_param(schedule_name, "schedule_name")
        check.inst_param(schedule_execution_data_mode,
                         "schedule_execution_data_mode",
                         ScheduleExecutionDataMode)

        repo_origin = repository_handle.get_origin()
        args = ExternalScheduleExecutionArgs(
            instance_ref=instance.get_ref(),
            repository_origin=repo_origin,
            schedule_name=schedule_name,
            schedule_execution_data_mode=schedule_execution_data_mode,
        )
        recon_repo = recon_repository_from_origin(repo_origin)
        return get_external_schedule_execution(recon_repo, args)