Пример #1
0
    def insertTaskDeps(self, task):
        """
        Insert a task in the queue previous analysis of its dependencies
        (as expressed in its spec file), and possible modification of its
        'reqs' field as a result of it.

        The 'task' must be a dict as defined in TQComp.Apis.TQApiData.Task.
        """

#        self.logger.debug('Inserting task: %s, %s, %s, %s' %\
#                     (spec, sandbox, wkflow, type))

        # This may raise a ValueError exception if not compliant
        validateTask(task)

        # Inspect deps
        inputFiles = self.__parseInputFiles(task['spec'])
        if inputFiles:
            for file in inputFiles:
            # For each file we include a dependency that is significant only 
            # for 10 seconds (after that, it is just: 'and True') but is still
            # counted in the ranking (more points for this task if the pilot
            # holds the file). 
            # We might change this when we make out our mind about how we want
            # data dependencies to work (if we want it to be like this, we'd 
            # be probably better off by having a configurable ranking 
            #expression, instead using QTIME's trick).
                task['reqs'] += " and (('%s' in cache) or (QTIME()>10))" % (file)
            
        # Insert job and its characteristics into the database
        self.transaction.begin()
        self.queries.addTask(task)
        self.transaction.commit()
Пример #2
0
 def insertTaskBulk(self, taskList):
     """
     Insert a bunch of tasks.
     The 'taskList' must be a list of dicts as defined in
     TQComp.Apis.TQApiData.Task.
     """
     where = 0
     todel = []
     for task in taskList:
         try:
             validateTask(task)
         except ValueError, inst:
             self.logger.warning('%s' % inst)
             todel.insert(0,where)
         where += 1
Пример #3
0
    def insertTask(self, task):
        """
        Insert a task in the queue.
        The 'task' must be a dict as defined in TQComp.Apis.TQApiData.Task.
        """

#        self.logger.debug('Inserting task: %s, %s, %s, %s' %\
#                     (spec, sandbox, wkflow, type))

        # This may raise a ValueError exception if not compliant
        validateTask(task)
            
        # Insert job and its characteristics into the database
        self.transaction.begin()
        self.queries.addTask(task)
        self.transaction.commit()
Пример #4
0
 def insertTaskBulkDeps(self, taskList):
     """
     Insert a bunch of tasks in the queue previous analysis of its 
     dependencies (as expressed in its spec file), and possible modification
     of its 'reqs' field as a result of it.
     
     The 'taskList' must be a list of dicts as defined in
     TQComp.Apis.TQApiData.Task.
     """
     where = 0
     todel = []
     for task in taskList:
         try:
             validateTask(task)
             # Inspect deps
             inputFiles = self.__parseInputFiles(task['spec'])
             if inputFiles:
                 for file in inputFiles:
                     task['reqs'] += " and (('%s' in cache) or (QTIME()>10))" % (file)
         except ValueError, inst:
             self.logger.warning('%s' % inst)
             todel.insert(0,where)
         where += 1