Esempio n. 1
0
        def type_check(self, value):
            from dagster.core.definitions.events import Failure

            if not isinstance(value, tuple):
                raise Failure('Value {value} should be a python tuple'.format(
                    value=value))

            if len(value) != len(runtime_types):
                raise Failure(
                    'Tuple with key {key} requires {n} entries. Received tuple with {m} values'
                    .format(key=self.key, n=len(runtime_types), m=len(value)))

            for item, runtime_type in zip(value, runtime_types):
                runtime_type.type_check(item)
 def should_fail(_):
     raise Failure(
         description="Foolure",
         metadata_entries=[
             EventMetadataEntry.text(label="label", text="text", description="description")
         ],
     )
Esempio n. 3
0
    def type_check(self, value):
        from dagster.core.definitions.events import Failure

        if not isinstance(value, list):
            raise Failure('Value must be a list, got {value}'.format(value=value))

        for item in value:
            self.inner_type.type_check(item)
Esempio n. 4
0
        def type_check(self, value):
            from dagster.core.definitions.events import Failure

            if not isinstance(value, set):
                raise Failure(
                    'Value {value} should be a set'.format(value=value))

            for item in value:
                item_runtime_type.type_check(item)
Esempio n. 5
0
        def type_check(self, value):
            from dagster.core.definitions.events import Failure

            if not isinstance(value, dict):
                raise Failure(
                    'Value {value} should be a dict'.format(value=value))

            for key, value in value.items():
                key_type.type_check(key)
                value_type.type_check(value)
Esempio n. 6
0
    def type_check(self, value):
        from dagster.core.definitions.events import Failure

        if not isinstance(value, self.python_type):
            raise Failure(
                'Value {value} should be of type {type_name}.'.format(
                    value=value, type_name=self.python_type.__name__))

        if self.metadata_fn:
            return self.metadata_fn(value)
Esempio n. 7
0
    def type_check(self, value):
        from dagster.core.definitions.events import Failure

        if self._user_type_check is not None:
            self._user_type_check(value)
        elif not isinstance(value, self.python_type):
            raise Failure(
                'Value of type {value_type} failed type check for Dagster type {dagster_type}, '
                'expected value to be of Python type {expected_type}.'.format(
                    value_type=type(value),
                    dagster_type=self.name,
                    expected_type=self.python_type.__name__,
                ))

        if self.typecheck_metadata_fn:
            return self.typecheck_metadata_fn(value)
Esempio n. 8
0
    def type_check(self, value):
        from dagster.core.definitions.events import Failure

        if value is not None:
            raise Failure('Value {value} must be None.')
Esempio n. 9
0
    def type_check(self, value):
        from dagster.core.definitions.events import Failure

        if not isinstance(value, bool):
            raise Failure(_typemismatch_error_str(value, 'bool'))
Esempio n. 10
0
def _throw_if_not_string(value):
    from dagster.core.definitions.events import Failure

    if not isinstance(value, six.string_types):
        raise Failure(_typemismatch_error_str(value, 'string'))
Esempio n. 11
0
 def failure_solid(_):
     raise Failure()
Esempio n. 12
0
 def should_fail(_):
     raise Failure(
         description="Foolure",
         metadata_entries=[MetadataEntry("label", value="text")],
     )