Differential D9218 Diff 42881 python_modules/dagster/dagster_tests/core_tests/test_resolve_versions.py
Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster/dagster_tests/core_tests/test_resolve_versions.py
Show First 20 Lines • Show All 836 Lines • ▼ Show 20 Lines | def test_version_strategy_on_pipeline(): | ||||
def ten_pipeline(): | def ten_pipeline(): | ||||
my_solid() | my_solid() | ||||
with instance_for_test() as instance: | with instance_for_test() as instance: | ||||
execute_pipeline(ten_pipeline, instance=instance) | execute_pipeline(ten_pipeline, instance=instance) | ||||
memoized_plan = create_execution_plan(ten_pipeline, instance=instance) | memoized_plan = create_execution_plan(ten_pipeline, instance=instance) | ||||
assert len(memoized_plan.step_keys_to_execute) == 0 | assert len(memoized_plan.step_keys_to_execute) == 0 | ||||
def test_version_strategy_no_resource_version(): | |||||
@solid(required_resource_keys={"foo"}) | |||||
def my_solid(context): | |||||
return context.resources.foo | |||||
@resource | |||||
def foo_resource(): | |||||
return "bar" | |||||
class MyVersionStrategy(VersionStrategy): | |||||
def get_solid_version(self, _): | |||||
return "foo" | |||||
@pipeline( | |||||
version_strategy=MyVersionStrategy(), | |||||
mode_defs=[ | |||||
ModeDefinition( | |||||
resource_defs={ | |||||
"io_manager": IOManagerDefinition.hardcoded_io_manager( | |||||
VersionedInMemoryIOManager() | |||||
), | |||||
"foo": foo_resource, | |||||
} | |||||
) | |||||
], | |||||
) | |||||
def my_pipeline(): | |||||
my_solid() | |||||
with instance_for_test() as instance: | |||||
execute_pipeline(my_pipeline, instance=instance) | |||||
memoized_plan = create_execution_plan(my_pipeline, instance=instance) | |||||
assert len(memoized_plan.step_keys_to_execute) == 0 |