Пример #1
0
    )
    wrapper.add_plan(Job.INIT_JOB, Job.START, "hello Serious")
    wrapper.add_plan("hello Serious", Job.DONE, "hello Kidding")
    wrapper.add_plan("hello Kidding", Job.DONE, "Serious")
    wrapper.add_plan("Serious", Job.DONE, "Kidding")
    wrapper.add_plan("Kidding", Job.DONE, Job.LAST_JOB)

    """
    same as previous tutorial
    but we declare the output, 'msg_to_[name]',which represent the message to be kept.
    the callback are also modified.
    """
    # ==
    j_temp = JobNode(id="hello template", desc="say hello to someone")
    j_temp.need_input("msg", "hello! Mr.[name]")
    j_temp.need_output("msg_to_[name]")
    j_temp.set_callback(hello_job)

    """
    remember we mentioned in the tutorial_04 that all the inputs should be
    explicitly declared. same as output. actually, it's fine if you don't
    declare the outputs; the process will still be executed correctly.
    however, this strategy is trying to improve the readability of the code.
    a person just take your code may be not familiar with the flow. the declared
    outputs will be listed in the generated document and help the folk to catch
    the key concepts of the job.
    """

    """
    same as previous tutorial
    """
Пример #2
0
    map(lambda key: Job.set_global(key, CFG[key]), configs_for_jobs.keys())

    wrapper = JobBlock(
        'entry job', '''
        this job demonstrate how to use config management module
    ''')
    wrapper.add_plan(Job.INIT_JOB, Job.START, 'foo')
    wrapper.add_plan('foo', Job.DONE, Job.LAST_JOB)
    '''
    we could get the configs we just set as global by giving the key without value
    or, we could put it into some other input

    here we also introduce another usage of output:
    in the tutorial_04, we set the key of output without value; that's a kind of
    declaration to exclaim 'we will put some value with that key as the output.
    (and the later jobs could access it as input)
    this time, we do give value to output key because we want the job output
    something to the path we expected.
    '''
    j = JobNode(id='foo', desc=''' foo ''')
    j.need_input('a very long path blah blah')
    j.need_input(
        'composite path',
        '[another very long path blah blah]/append_with_a_sub_directory')
    j.need_output('output_path', '[yet another very long path blah blah]')
    j.set_callback(foo_job)
    wrapper.add_sub_job(j)

    job_id, state = wrapper.execute()
    #raw_input()
Пример #3
0
     this job demonstrate how to utilize variablized configuration
 ''')
 wrapper.add_plan(Job.INIT_JOB, Job.START, 'hello Serious')
 wrapper.add_plan('hello Serious', Job.DONE, 'hello Kidding')
 wrapper.add_plan('hello Kidding', Job.DONE, 'Serious')
 wrapper.add_plan('Serious', Job.DONE, 'Kidding')
 wrapper.add_plan('Kidding', Job.DONE, Job.LAST_JOB)
 '''
 same as previous tutorial
 but we declare the output, 'msg_to_[name]',which represent the message to be kept.
 the callback are also modified.
 '''
 # ==
 j_temp = JobNode(id='hello template', desc='say hello to someone')
 j_temp.need_input('msg', 'hello! Mr.[name]')
 j_temp.need_output('msg_to_[name]')
 j_temp.set_callback(hello_job)
 '''
 remember we mentioned in the tutorial_04 that all the inputs should be
 explicitly declared. same as output. actually, it's fine if you don't
 declare the outputs; the process will still be executed correctly.
 however, this strategy is trying to improve the readability of the code.
 a person just take your code may be not familiar with the flow. the declared
 outputs will be listed in the generated document and help the folk to catch
 the key concepts of the job.
 '''
 '''
 same as previous tutorial
 '''
 # ==
 j = deepcopy(j_temp)
Пример #4
0
    map(lambda key: Job.set_global(key, CFG[key]), configs_for_jobs.keys())


    wrapper = JobBlock('entry job', '''
        this job demonstrate how to use config management module
    ''')
    wrapper.add_plan(Job.INIT_JOB, Job.START, 'foo')
    wrapper.add_plan('foo', Job.DONE, Job.LAST_JOB)

    '''
    we could get the configs we just set as global by giving the key without value
    or, we could put it into some other input

    here we also introduce another usage of output:
    in the tutorial_04, we set the key of output without value; that's a kind of
    declaration to exclaim 'we will put some value with that key as the output.
    (and the later jobs could access it as input)
    this time, we do give value to output key because we want the job output
    something to the path we expected.
    '''
    j = JobNode(id='foo', desc=''' foo ''')
    j.need_input('a very long path blah blah')
    j.need_input('composite path', '[another very long path blah blah]/append_with_a_sub_directory')
    j.need_output('output_path','[yet another very long path blah blah]')
    j.set_callback(foo_job)
    wrapper.add_sub_job(j)


    job_id, state = wrapper.execute()
    #raw_input()