Ejemplo n.º 1
0
class TestJob(TestCase):

    class TestStep(Step):
        pass

    def setUp(self):
        self.job = Job()

    def test_one_step_job(self):
        step = self.TestStep([], [])

        self.job.add_step(step)

        self.job.run()

    def test_two_step_job(self):
        step1 = self.TestStep([], [], name='step1')
        step2 = self.TestStep([], [], name='step2')

        self.job.add_step(step1)
        self.job.add_step(step2)

        self.job.run()
Ejemplo n.º 2
0
 def setUp(self):
     self.job = Job()
Ejemplo n.º 3
0
class InputStep(Step):
    def run(self):
        self.outputs = self.inputs
        return True


class ConvertStep(Step):
    def run(self):
        print self.outputs[0]
        return True


class OutputStep(Step):
    def run(self):
        print "lalala"
        return True


if __name__ == '__main__':
    step1 = '{"stepName": "examples.simple_job.InputStep", "outputs": ["out1"], "inputs": ["lalala"]}'
    step2 = '{"stepName": "examples.simple_job.ConvertStep", "inputs": ["out1"], "outputs": ["out2"]}'
    step3 = '{"stepName": "examples.simple_job.OutputStep", "inputs": ["out2"]}'

    job_desc = '{"job": {"steps": [%s, %s, %s]}}' % (step1, step2, step3)

    job = Job(job_desc)

    job.run()