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

Oscar Delicaat

03/16/2023, 2:35 PM
Hi guys, I built a sensor to check which Jobs started. I want to get the partition as a datetime. The only way I found is to get it from tags as follows:
Copy code
@run_status_sensor(run_status=DagsterRunStatus.STARTED, monitor_all_repositories=True,
                   minimum_interval_seconds=60, default_status=DefaultSensorStatus.RUNNING)
def run_started_sensor(context):
    partition = context.dagster_run.tags["dagster/partition"]
However, the partition is now a string instead of a datetime and the format is different for both hourly / daily. Is there another way to get the partition as a datetime? Thanks! Oscar
y

yuhan

03/16/2023, 11:12 PM
you should be able to convert those strings using
datetime.datetime
o

Oscar Delicaat

03/17/2023, 12:44 PM
Hi @yuhan, I indeed wrote a small utility function for this but it would be nice if the output would just be a datetime. Now instead I as a user need to know what the potential datetime string formats are in order to be able to parse them. Seems like some internal details I wouldn't need to know in order to use this. 🙂 What do you think?