Trevor Kramer
03/08/2021, 5:29 PMprefect.context.get('flow_run_name')
How do I get the flow run name (like zealous-dormouse) from inside the flow?Dylan
flow.run()
Dylan
Trevor Kramer
03/08/2021, 5:32 PMTrevor Kramer
03/08/2021, 5:32 PMDylan
Dylan
Dylan
Trevor Kramer
03/08/2021, 5:36 PMbatch_task = BatchSubmit(job_name=prefect.context.get('flow_run_name', 'RF Training Job'))(job_queue=export_result['job_queue_arn'],
job_definition=export_result[
'job_definition_arn'],
batch_kwargs={
'parameters': {
'x_train': x_train_location,
'y_train': y_train_location,
'model_location': model_location,
'max_features': max_features,
'min_samples_leaf': min_samples_leaf,
'min_samples_split': min_samples_split,
'n_estimators': n_estimators,
'n_streams': n_streams,
'random_state': random_state}})
AWSClientWait(client='batch', waiter_name='JobComplete')(waiter_kwargs={'jobs': [batch_task]})
this in run inside a with Flow() blockDylan
Dylan
prefect.context.get()
needs to be called from within a Task’s run
method, not just from inside the Flow’s context blockDylan
BatchSubmit
task so that the job name can be parameterized from contextDylan
Marvin
03/08/2021, 5:46 PMTrevor Kramer
03/08/2021, 6:29 PMDylan
Dylan