You are viewing an old version of this page. View the current version.

    Compare with Current View Page History

    « Previous Version 14 Current »

    The next step is to build a more robust dependency system. Building on what we have learnt in the previous tutorials this tutorial will: 

    • Give example of JobLabel for linking jobs 
    • Give example of Dependency linking to JobLabel
    • Shows correct dependency graph in the Qube! GUI

    Feel free to download and run the script below. It sets up a job that will :

    • Create a Parent "Sleep job" with a range of 60 
    • Create a Blocked Child "Sleep job" that links to the Parent job and waits for a complete status before starting

    Advanced_Dependency.py

    This script differs from the rest quite a lot:

    task = []

    To create a list of jobs that are submitted:

    task.append(job)

    Combines the list of jobs for final submission with:

    listOfSubmittedJobs = qb.submit(task)

    With this method the jobs are not submitted per "job = {}" instead combined and submitted once all tasks have completed:

    job['label']= 'ParentLabel'

    This creates a internal label for the job which is assessed at submission time:

    job['dependency'] = 'link-complete-job-ParentLabel'

    The Child job then uses the internal label to link to the Parent job.

     

    Here are some examples of how you can link the jobs: 

    job['dependency'] = 'link-complete-job-ParentLabel'

    This will run once the Parent job is complete.

    job['dependency'] = 'link-failed-job-ParentLabel'

    This will run once the Parent job is failed.

    job['dependency'] = 'link-killed-job-ParentLabel'

    This will run if the Parent job has been killed.

    job['dependency'] = 'link-done-job-ParentLabel'

    This will run once the Parent job returns a status of done. Done means if the job completes,fails or has been killed.

     

    You can also link jobs by different types.

    job['dependency'] = 'link-done-work-ParentLabel'

    This will run depending on the status of the jobs work.

    job['dependency'] = 'link-done-subjob-ParentLabel'

    This will run depending on the status of the jobs subjobs.

    See Also

    Job Dependency Attribute Syntax

    • No labels