cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to get the runId, jobId of ephemeral job created in a notebook workflow from parent notebook?

User16869510359
Esteemed Contributor
 
1 ACCEPTED SOLUTION

Accepted Solutions

User16869510359
Esteemed Contributor

One solution is to get the runId,jobId details using notebook context in child notebook and return these values using dbutils.notebook.exit to parent notebook.

%scala
val jobId = dbutils.notebook.getContext.tags("jobId").toString()
val runId = dbutils.notebook.getContext.tags("jobId").toString()
 
 
 
%scala
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper
import com.fasterxml.jackson.databind.ObjectMapper
 
val jsonMapper = new ObjectMapper with ScalaObjectMapper
jsonMapper.registerModule(DefaultScalaModule)
 
dbutils.notebook.exit(jsonMapper.writeValueAsString(Map("jobId" -> jobId, "runId" -> runId)))

View solution in original post

1 REPLY 1

User16869510359
Esteemed Contributor

One solution is to get the runId,jobId details using notebook context in child notebook and return these values using dbutils.notebook.exit to parent notebook.

%scala
val jobId = dbutils.notebook.getContext.tags("jobId").toString()
val runId = dbutils.notebook.getContext.tags("jobId").toString()
 
 
 
%scala
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper
import com.fasterxml.jackson.databind.ObjectMapper
 
val jsonMapper = new ObjectMapper with ScalaObjectMapper
jsonMapper.registerModule(DefaultScalaModule)
 
dbutils.notebook.exit(jsonMapper.writeValueAsString(Map("jobId" -> jobId, "runId" -> runId)))

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.