https://dagster.io/ logo
#ask-community
Title
# ask-community
f

Frederik Löw

06/16/2023, 7:38 PM
Hey, this question is about the function "materialize_to_memory" and partitioned assets. I am using this function in my tests. If use static partitions and provide "partition_key" param everything works fine, if is use dynamic partitions and provide "partition_key" param it doesn't work. The error is :
dagster._check.CheckError: Failure condition: The instance is not available to load partitions. You may be seeing this error when using dynamic partitions with a version of dagit or dagster-cloud that is older than 1.1.18.
I am using version 1.3.4 If I compare static partitions to dynamic partitions, the main difference in this context comming to my mind is the fact that the partitions don't exist yet for the dynamic partitions case because the "materialize_to_memory" only executes the assets and not the dynamic partitions, which I am creating with a sensor. Can someone please help me understand the issue? Best regards Frederik
o

owen

06/16/2023, 9:50 PM
hi @Frederik Löw! Mind sharing the full stack trace? This seems like a bug on our end in which an internal method is not being passed a newly-required parameter, so the stack trace will help diagnose the callsite
and just out of curiosity, are you providing an
instance
to
materialize_to_memory
? dynamic partitions are stored in the instance, so you'd need to create a test dagster instance (DagsterInstance.ephemeral() should work), then add a dynamic partition to that instance before executing (I still wouldn't expect this error without doing that, thouugh)
f

Frederik Löw

06/19/2023, 3:43 PM
Hey @owen, here is the full trace:
Copy code
Loading definitions for environment:  local
Traceback (most recent call last):
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/reporting_pipeline/reporting_pipeline_tests/test_assets.py", line 68, in <module>
    test_graph_of_assets()
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/reporting_pipeline/reporting_pipeline_tests/test_assets.py", line 61, in test_graph_of_assets
    result = materialize_to_memory(
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/definitions/materialize.py", line 193, in materialize_to_memory
    return materialize(
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/definitions/materialize.py", line 103, in materialize
    return check.not_none(
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/definitions/job_definition.py", line 659, in execute_in_process
    self.partitions_def.validate_partition_key(
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/definitions/partition.py", line 268, in validate_partition_key
    if not self.has_partition_key(partition_key, current_time, dynamic_partitions_store):
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/definitions/partition.py", line 498, in has_partition_key
    check.failed(
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_check/__init__.py", line 1669, in failed
    raise CheckError(f"Failure condition: {desc}")
dagster._check.CheckError: Failure condition: The instance is not available to load partitions. You may be seeing this error when using dynamic partitions with a version of dagit or dagster-cloud that is older than 1.1.18.
I am currently not using an instance. I will try your solution, thank you! 🙂
This worked. Thanks again. If you need anything to clarify whats happening let me know.
o

owen

06/21/2023, 6:10 PM
gotcha, glad it's working now!
f

Frederik Löw

07/25/2023, 2:03 PM
Hey @owen, I am having a similar issue now, but with a schedule. The error message looks similar as the one from before:
Copy code
Copy
dagster._core.errors.ScheduleExecutionError: Error occurred during the evaluation of schedule sophia_1_schedule

  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_grpc/impl.py", line 324, in get_external_schedule_execution
    return schedule_def.evaluate_tick(schedule_context)
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/definitions/schedule_definition.py", line 845, in evaluate_tick
    result = list(ensure_gen(execution_fn(context)))
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/definitions/decorators/schedule_decorator.py", line 165, in _wrapped_fn
    yield from cast(RunRequestIterator, ensure_gen(result))
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/errors.py", line 298, in user_code_error_boundary
    raise error_cls(

The above exception was caused by the following exception:
dagster._check.CheckError: Failure condition: The instance is not available to load partitions. You may be seeing this error when using dynamic partitions with a version of dagster-webserver or dagster-cloud that is older than 1.1.18.

  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/errors.py", line 291, in user_code_error_boundary
    yield
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/definitions/decorators/schedule_decorator.py", line 165, in _wrapped_fn
    yield from cast(RunRequestIterator, ensure_gen(result))
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/reporting_pipeline/reporting_pipeline/schedules.py", line 16, in sophia_1_schedule
    partitions = sophia_assets_partition_dynamic.get_partition_keys()
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_core/definitions/partition.py", line 482, in get_partition_keys
    check.failed(
  File "/home/AD.EKUPD.COM/frederik.loew/Dokumente/data_engineering/dagster_report_service/venv/lib/python3.8/site-packages/dagster/_check/__init__.py", line 1669, in failed
    raise CheckError(f"Failure condition: {desc}")
3 Views