cancel
Showing results for 
Search instead for 
Did you mean: 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve task name within workflow task (notebook, python)?

EWhitley
New Contributor III

Using workflows, is there a way to obtain the task name from within a task?

EX: I have a workflow with a notebook task. From within that notebook task I would like to retrieve the task name so I can use it for a variety of purposes.

Currently, we're requiring users to pass the task name into he task using a task parameter. That works, but is another point of configuration and error-prone.

We'd like to obtain the task name from within the task at runtime.

This was asked in a prior conversation (https://community.databricks.com/t5/warehousing-analytics/from-within-a-databricks-notebook-how-do-y...), but not answered.

2 REPLIES 2

shan_chandra
Esteemed Contributor
Esteemed Contributor

@EWhitley - could you please try using jobs API - /api/2.1/jobs/get and look for task_key fields to obtain all the task name within a given job. 

Reference - https://docs.databricks.com/api/workspace/jobs/get

ttamas
New Contributor II
Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!