示例#1
0
    def get_intermediate_from_address(
        self,
        context,
        dagster_type=None,
        step_output_handle=None,
        address=None,
    ):
        """
        This is an experimental method.
        This will likely to be merged into `get_intermediate_object`. To do so, we will need to
        update the `get_intermediate_object` to take `address` as an arg
        """
        dagster_type = resolve_dagster_type(dagster_type)
        check.opt_inst_param(context, "context", SystemExecutionContext)
        check.inst_param(dagster_type, "dagster_type", DagsterType)
        check.inst_param(step_output_handle, "step_output_handle",
                         StepOutputHandle)
        check.str_param(address, "address")

        # currently it doesn't support type_storage_plugin_registry
        try:
            obj, uri = self.object_store.get_object(
                key=address,
                serialization_strategy=dagster_type.serialization_strategy)
            return ObjectStoreOperation(
                op=ObjectStoreOperationType.GET_OBJECT,
                key=uri,
                dest_key=None,
                obj=obj,
                serialization_strategy_name=dagster_type.
                serialization_strategy.name,
                object_store_name=self.object_store.name,
            )
        except (IOError, OSError) as e:
            raise DagsterAddressIOError(str(e))
    def set_intermediate_to_address(self,
                                    context,
                                    dagster_type=None,
                                    step_output_handle=None,
                                    value=None,
                                    address=None):
        """
        This is an experimental method.
        This will likely to be merged into `set_intermediate_object`. To do so, we will need to
        update the `set_intermediate_object` to take `address` as an arg
        """
        dagster_type = resolve_dagster_type(dagster_type)
        check.opt_inst_param(context, "context", SystemExecutionContext)
        check.inst_param(dagster_type, "dagster_type", DagsterType)
        check.inst_param(step_output_handle, "step_output_handle",
                         StepOutputHandle)
        check.str_param(address, "address")

        # currently it doesn't support type_storage_plugin_registry
        try:
            return self.object_store.set_object(
                key=address,
                obj=value,
                serialization_strategy=dagster_type.serialization_strategy)
        except IOError as e:
            raise DagsterAddressIOError(str(e))
示例#3
0
    def has_intermediate_at_address(self, address=None):
        """
        This is an experimental method.
        This will likely to be merged into `has_intermediate`. To do so, we will need to
        update the `has_intermediate` to take `address` as an arg
        """
        check.str_param(address, "address")

        # currently it doesn't support type_storage_plugin_registry
        try:
            return self.object_store.has_object(key=address)
        except (IOError, OSError) as e:
            raise DagsterAddressIOError(str(e))