pythonazkaban

How to get job-name from job file in azkaban 3.0


We need the job name from Azkaban when trying to schedule a job. Is there any built-in property for that? We are getting the flow name from ${azkaban.job.flowid}.

Eg: My job file is:

type=command
command=python xyz.py ${azkaban.job.attempt} ${azkaban.job.flowid}

Solution

  • Found the answer:

    Azkaban jobs run with following Environment variables:

    { JOB_OUTPUT_PROP_FILE='xxx',
      JOB_PROP_FILE='xxx',
      JOB_NAME='xxx' }
    

    The Job Name can be fetched easily by the following Python snippet:

    import os
    
    job_name = os.environ["JOB_NAME"]