Natalie Rozak
05/09/2023, 2:32 PM@op()
def get_predictions():
...
return accuracy
@graph()
def predictions_pipeline():
...
accuracy = get_predictions()
return accuracy
predictions_job = predictions_pipeline.to_job()
@sensor(job=retrain_job)
def retrain_model():
# get accuracy from predictions_job
# if accuracy < 0.7, retrain the model
Jordan
05/09/2023, 4:31 PMLe Yang
05/09/2023, 11:08 PMsean
05/10/2023, 1:32 PMpredictions_job
completes. The record for your job isn’t going to store your accuracy
value by default, so you need to make sure you’re using an IO manager that writes it somewhere you can access, then you can read the value in the sensor.
• Along the lines of what Jordan is saying, you can restructure your pipeline using software defined assets. accuracy
can become an asset, and you can use an Asset sensor to respond to new materializations of the asset. As with the first solution, the accuracy
value associated with the asset isn’t directly available in the sensor, but you can either:
◦ record the value as metadata in the generated materialization
◦ store e.g. a path in the metadata that will let you read the value