@api_experimental.route('/dags/<string:dag_id>/tasks/<string:task_id>', methods=['GET'])
@requires_authentication
def task_info(dag_id, task_id):
 from airflow.www.views import dagbag
 if (dag_id not in dagbag.dags):
  response = jsonify(error='Dag {} not found'.format(dag_id))
  response.status_code = 404
  return response
 dag = dagbag.dags[dag_id]
 if (not dag.has_task(task_id)):
  response = jsonify(error='Task {} not found in dag {}'.format(task_id, dag_id))
  response.status_code = 404
  return response
 task = dag.get_task(task_id)
 fields = {k: str(v) for (k, v) in vars(task).items() if (not k.startswith('_'))}
 return jsonify(fields)

@ api_experimental . route ( '/dags/<string:dag_id>/tasks/<string:task_id>' , methods = [ 'GET' ] ) @ requires_authentication def task_info ( dag_id , task_id ) : from airflow . www . views import dagbag if ( dag_id not in dagbag . dags ) : response = jsonify ( error = 'Dag {} not found' . format ( dag_id ) ) response . status_code = 404 return response dag = dagbag . dags [ dag_id ] if ( not dag . has_task ( task_id ) ) : response = jsonify ( error = 'Task {} not found in dag {}' . format ( task_id , dag_id ) ) response . status_code = 404 return response task = dag . get_task ( task_id ) fields = { k : str ( v ) for ( k , v ) in vars ( task ) . items ( ) if ( not k . startswith ( '_' ) ) } return jsonify ( fields )
returns a json with a tasks public instance variables .