Пример #1
0
    j = JobNode(id='fob', desc=''' fob ''')
    j.set_callback(fob_job)
    wrapper.add_sub_job(j)

    '''
    everything looks good in dry run mode.
    turn it off to test in real mode
    '''
    wrapper.set_dry_run(False)

    '''
    after several round of testing, i found most jobs work fine.
    but there's something strange in the second job. so I want to enable the
    real mode only for that job. then, we could set dry_run for indivisual job.
    however, the dry_run config is a global setting; once you set for any job,
    it will affect on the whole process. to specify the scope on the certain job,
    you need to set the config locally by set_as_local parameter.

    wait. there is another trick in the config: the sub jobs of a JobBlock will
    inherit the config from its parent. so you could limit the scope of real mode
    step by step to testing the ill job.
    '''
    wrapper.set_dry_run(True)
    j = wrapper.find_job('block')
    j.set_dry_run(False, set_as_local=True)


    # ==
    job_id, state = wrapper.execute()
    #raw_input()
Пример #2
0
    # --
    wrapper.add_sub_job(j)
    # ==
    j = JobNode(id='fob', desc=''' fob ''')
    j.set_callback(fob_job)
    wrapper.add_sub_job(j)
    '''
    everything looks good in dry run mode.
    turn it off to test in real mode
    '''
    wrapper.set_dry_run(False)
    '''
    after several round of testing, i found most jobs work fine.
    but there's something strange in the second job. so I want to enable the
    real mode only for that job. then, we could set dry_run for indivisual job.
    however, the dry_run config is a global setting; once you set for any job,
    it will affect on the whole process. to specify the scope on the certain job,
    you need to set the config locally by set_as_local parameter.

    wait. there is another trick in the config: the sub jobs of a JobBlock will
    inherit the config from its parent. so you could limit the scope of real mode
    step by step to testing the ill job.
    '''
    wrapper.set_dry_run(True)
    j = wrapper.find_job('block')
    j.set_dry_run(False, set_as_local=True)

    # ==
    job_id, state = wrapper.execute()
    #raw_input()
Пример #3
0
    '''

    # some other code
    # ...
    # ...

    '''
    say, we generate something here
    '''
    some_value = ' blah blah blah'

    '''
    and we want to append the value to the description of job1.
    how to get the object of job1?
    there's no need to give a unique variable, say job1, for just accessing it.
    (that increases the things you need to remember in code )
    all you need to do is asking the wrapper to search for that job.
    no matter how deep is the job inside the wrapper, it could be retrieved by
    recursion search.
    '''
    j =  wrapper.find_job('job1')
    j.desc += some_value


    '''
    check the result to re-exame the flow of the process
    '''
    # ==
    job_id, state = wrapper.execute()
    #raw_input()