Esempio n. 1
0
    def testCreation2(self):
        """
        creates a single task with N jobs
        """

        # log information
        logging.info("Test Creation 2: creating a task with %s jobs" % self.N)
        start = time()

        # create a session and db access
        session = SafeSession(dbInstance=self.dbInstance)
        db = TrackingDB(session)

        # create a task
        task = Task()
        task['name'] = 'task2'
        task['startDirectory'] = '/tmp/startdir'
        task['outputDirectory'] = '/tmp/outdir'
        task['globalSandbox'] = '/tmp/data_area'

        # create template for jobs
        template = {
            'inputFiles': ['a.txt', 'b.txt'],
            'executable': 'production.sh',
            'arguments': "-o c.txt",
            'outputFiles': ['c.txt'],
            'logFile': 'output.log'
        }

        # create list of N jobs
        jobs = []
        for index in range(1, self.N + 1):

            # set specific parameters
            template['name'] = 'job' + str(index)
            if index <= int(self.N / 2):
                template['logFile'] = 'output.log'
            else:
                template['logFile'] = 'useful.log'
            template['outputFiles'] = ['a.txt', 'b.txt']

            # add job to list
            jobs.append(Job(template))

        # add jobs to task
        task.addJobs(jobs)

        # save task (and jobs) in single transaction
        try:
            rows = task.save(db)
            session.commit()
        except TaskError, msg:
            self.fail("Error: " + str(msg))
Esempio n. 2
0
    def testCreation2(self):
        """
        creates a single task with N jobs
        """

        # log information
        logging.info("Test Creation 2: creating a task with %s jobs" % self.N)
        start = time()

        # create a session and db access
        session = SafeSession(dbInstance = self.dbInstance)
        db = TrackingDB(session)

        # create a task
        task = Task()
        task['name'] = 'task2'
        task['startDirectory'] = '/tmp/startdir'
        task['outputDirectory'] = '/tmp/outdir'
        task['globalSandbox'] = '/tmp/data_area'

        # create template for jobs
        template = { 'inputFiles' : ['a.txt', 'b.txt'],
                     'executable' : 'production.sh',
                     'arguments' : "-o c.txt",
                     'outputFiles' : ['c.txt'],
                     'logFile' : 'output.log' }

        # create list of N jobs
        jobs = []
        for index in range(1, self.N + 1):

            # set specific parameters
            template['name'] = 'job' + str(index)
            if index <= int(self.N / 2):
                template['logFile'] = 'output.log'
            else:
                template['logFile'] = 'useful.log'
            template['outputFiles'] = ['a.txt' , 'b.txt']

            # add job to list
            jobs.append(Job(template))

        # add jobs to task
        task.addJobs(jobs)

        # save task (and jobs) in single transaction
        try:
            rows = task.save(db)
            session.commit()
        except TaskError, msg:
            self.fail("Error: " + str(msg))
Esempio n. 3
0
    def testCreation1(self):
        """
        creates a single task with 2 jobs
        """

        # log information
        print "Creation tests"
        logging.info("Test Creation 1: creating a task with two jobs")
        start = time()

        # create a session and db access
        session = SafeSession(dbInstance=self.dbInstance)
        db = TrackingDB(session)

        # create a task
        task = Task()
        task['name'] = 'task1'
        task['startDirectory'] = '/tmp/startdir'
        task['outputDirectory'] = '/tmp/output'
        task['globalSandbox'] = '/tmp/inputdata'

        # create first job
        job1 = Job()
        job1['name'] = 'job1'
        job1['executable'] = 'test.sh'
        job1['inputFiles'] = ['a.txt', 'b.txt']
        job1['outputFiles'] = ['c.txt']

        # create second job
        job2 = Job()
        job2['name'] = 'job2'
        job2['executable'] = 'production.sh'
        job2['arguments'] = "-o c.txt"

        # add jobs to task
        task.addJobs([job1, job2])

        # save task in single transaction
        try:
            rows = task.save(db)
            session.commit()
        except TaskError, msg:
            self.fail("Error: " + str(msg))
Esempio n. 4
0
    def testCreation1(self):
        """
        creates a single task with 2 jobs
        """

        # log information
        print "Creation tests"
        logging.info("Test Creation 1: creating a task with two jobs")
        start = time()

        # create a session and db access
        session = SafeSession(dbInstance = self.dbInstance)
        db = TrackingDB(session)

        # create a task
        task = Task()
        task['name'] = 'task1'
        task['startDirectory'] = '/tmp/startdir'
        task['outputDirectory'] = '/tmp/output'
        task['globalSandbox'] = '/tmp/inputdata'

        # create first job
        job1 = Job()
        job1['name'] = 'job1'
        job1['executable'] = 'test.sh'
        job1['inputFiles'] = ['a.txt', 'b.txt']
        job1['outputFiles'] = ['c.txt']

        # create second job
        job2 = Job()
        job2['name'] = 'job2'
        job2['executable'] = 'production.sh'
        job2['arguments'] = "-o c.txt"

        # add jobs to task
        task.addJobs([job1, job2])

        # save task in single transaction
        try:
            rows = task.save(db)
            session.commit()
        except TaskError, msg:
            self.fail("Error: " + str(msg))