Hi Dagster, we’ve just set up a multi_asset_sensor...
# ask-community
j
Hi Dagster, we’ve just set up a multi_asset_sensor but we’re getting this error, see thread 🧵
☝️ 1
Copy code
dagster._core.errors.SensorExecutionError: Error occurred during the execution of evaluation_fn for sensor trigger_main_pipeline_on_prod_dms
  File "/usr/local/lib/python3.8/site-packages/dagster/_grpc/impl.py", line 324, in get_external_sensor_execution
    return sensor_def.evaluate_tick(sensor_context)
  File "/usr/local/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.8/site-packages/dagster/_core/errors.py", line 206, in user_code_error_boundary
    raise error_cls(
The above exception was caused by the following exception:
AttributeError: 'int' object has no attribute 'items'
  File "/usr/local/lib/python3.8/site-packages/dagster/_core/errors.py", line 199, in user_code_error_boundary
    yield
  File "/usr/local/lib/python3.8/site-packages/dagster/_grpc/impl.py", line 324, in get_external_sensor_execution
    return sensor_def.evaluate_tick(sensor_context)
  File "/usr/local/lib/python3.8/site-packages/dagster/_core/definitions/sensor_definition.py", line 425, in evaluate_tick
    result = list(self._evaluation_fn(context))
  File "/usr/local/lib/python3.8/site-packages/dagster/_core/definitions/sensor_definition.py", line 594, in _wrapped_fn
    for item in result:
  File "/usr/local/lib/python3.8/site-packages/dagster/_core/definitions/multi_asset_sensor_definition.py", line 1101, in _fn
    multi_asset_sensor_context = MultiAssetSensorEvaluationContext(
  File "/usr/local/lib/python3.8/site-packages/dagster/_annotations.py", line 123, in __init__
    undecorated_init(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/dagster/_core/definitions/multi_asset_sensor_definition.py", line 253, in __init__
    self._unpacked_cursor = MultiAssetSensorContextCursor(cursor, self)
  File "/usr/local/lib/python3.8/site-packages/dagster/_core/definitions/multi_asset_sensor_definition.py", line 128, in __init__
    for str_asset_key, cursor_list in loaded_cursor.items():
n
Same for me, just had it with latest Dagster 1.1.8.
Strangely, I can't reproduce it with a simple example:
Copy code
from dagster import multi_asset_sensor, RunRequest, AssetSelection, asset, define_asset_job, Definitions


@asset
def asset1():
    return [1, 2, 3]


@asset
def asset2(asset1):
    return asset1 + [4]


@asset
def asset3(asset2):
    return asset2 + [4]


my_job12 = define_asset_job(name="j12", selection=AssetSelection.assets(asset1, asset2))
my_job3 = define_asset_job(name="j3", selection=AssetSelection.assets(asset3))


@multi_asset_sensor(
    asset_selection=AssetSelection.assets(asset1, asset2),
    job=my_job3,
)
def asset_1_and_2_sensor(context):
    asset_events = context.latest_materialization_records_by_key()
    if all(asset_events.values()):
        context.advance_all_cursors()
        return RunRequest()


defs = Definitions(
    assets=[asset1, asset2, asset3],
    jobs=[my_job12, my_job3],
    sensors=[asset_1_and_2_sensor]
)
s
@claire @jamie it sounds like the multi-asset sensor cursor is an integer, when Dagster expects it to be a dict. Is it possible this is a backwards-compatibility issue where it used to be an int and we changed it to a dict?
c
I don't believe the multi asset sensor ever stored an
int
cursor. My guess about what's happening is you had some other type of sensor (i.e. an asset sensor) that had the same name as your multi-asset sensor. When dagster attempts to read the cursor from storage, that cursor will be your asset sensor cursor instead of a new cursor. You could fix this by renaming your sensor to something new and unused, or you could reset the cursor:
Copy code
dagster sensor cursor --delete
🚀 3
j
Ah yes, that is exactly it! Thank you
I deleted the cursor value in dagit and turned the sensor and on and off and it created the correct cursor value for me 👍
D 1
155 Views