https://dagster.io/ logo
Title
s

shailesh

11/22/2022, 1:03 PM
Hi there, I had two repositories Repository A Repository B I want to create sensor which will trigger Repository B after successful materialisation of Repository B. Any idea/reference how I can implement it? 🙏
:dagster-bot-resolve: 1
s

Sean Lopp

11/22/2022, 2:51 PM
What is in the repositories? If you have assets in repository A and assets in repository B you can use an asset sensor in repository B that watches for a
SourceAsset
in A: https://github.com/slopp/dagteam/blob/main/ml_project/ml_project/repository.py#L8-L14
s

shailesh

11/22/2022, 2:59 PM
I had multi assets of meltnao and DBT in both the repositories with a jobs which execute melatno and then DBT. So I want to execute job in repository B after completion of job of Repository A. I am planning to have a sensor in repository B with below code. Let me know it is right approach or not?
@sensor(job=sensor_job)    
def transform_run_sensor(context):
       
   run_records = context.instance.get_run_records(
    filters=RunsFilter(
                job_name=f"test_data_elt",
                statuses=[PipelineRunStatus.SUCCESS]
            ),
            order_by="update_timestamp",
            ascending=False,
        )

# here ob_name=f"test_data_elt" is the job name of repository A
s

Sean Lopp

11/22/2022, 4:11 PM
I would try the new multi-asset sensor https://docs.dagster.io/concepts/partitions-schedules-sensors/asset-sensors#multi-asset-sensors-experimental so repository B would have a sensor that watches for updates in the meltnao asset(s) - id'd as SourceAsset - and then launches the dbt asset job