Example #1
0
def create_task_object(synergy_object, ccm):
    object = TaskObject(synergy_object.get_object_name(),
                        synergy_object.get_separator(),
                        synergy_object.get_author(),
                        synergy_object.get_status(),
                        synergy_object.get_created_time(),
                        synergy_object.get_tasks())
    object.released_projects = get_projects_for_task(synergy_object, ccm)
    object.baselines = get_baselines_for_task(synergy_object, ccm)
    return object
Example #2
0
 def update_task_in_history_with_objects(self, task, objects):
     # Find the task in history if its there
     found = False
     for t in self.history[self.tag]['tasks']:
         if t.get_object_name() == task:
             if t.objects:
                 t.objects.extend(
                     [o for o in objects if ':project:' not in o])
                 t.objects = list(set(t.objects))
             else:
                 t.objects = [o for o in objects if ':project:' not in o]
             found = True
     if not found:
         t = ccm_cache.get_object(task, self.ccm)
         if t.type == 'task':
             t.objects = [o for o in objects if ':project:' not in o]
             self.history[self.tag]['tasks'].append(t)
         elif t.type == 'dir':
             # Make a task from the directory object
             task_obj = TaskObject(
                 "%s%s%s:task:%s" %
                 (t.name, self.delim, t.version, t.instance), self.delim,
                 t.author, t.status, t.created_time, t.tasks)
             task_obj.set_attributes(t.attributes)
             task_obj.complete_time = t.get_integrate_time()
             task_obj.objects = [o for o in objects if ':project:' not in o]
             self.history[self.tag]['tasks'].append(task_obj)
Example #3
0
 def update_task_in_history_with_objects(self, task, objects):
     # Find the task in history if its there
     found = False
     for t in self.history[self.tag]['tasks']:
         if t.get_object_name() == task:
             if t.objects:
                 t.objects.extend([o for o in objects if ':project:' not in o])
                 t.objects = list(set(t.objects))
             else:
                 t.objects = [o for o in objects if ':project:' not in o]
             found = True
     if not found:
         t = ccm_cache.get_object(task, self.ccm)
         if t.type == 'task':
             t.objects = [o for o in objects if ':project:' not in o]
             self.history[self.tag]['tasks'].append(t)
         elif t.type == 'dir':
             # Make a task from the directory object
             task_obj = TaskObject("%s%s%s:task:%s" %(t.name, self.delim, t.version, t.instance), self.delim, t.author, t.status, t.created_time, t.tasks)
             task_obj.set_attributes(t.attributes)
             task_obj.complete_time = t.get_integrate_time()
             task_obj.objects = [o for o in objects if ':project:' not in o]
             self.history[self.tag]['tasks'].append(task_obj)
    def add(self, resource_name, owner=None):
        """ add resource to resource container """
        # generate unique temporary id
        resource_id = uuid.uuid4().int

        if self._resource_type == ResourceType.VICTIMS:
            resource_object = VictimObject()
        elif self._resource_type == ResourceType.BATCH_JOBS:
            resource_object = BatchJobObject()
        elif self._resource_type == ResourceType.TASKS:
            resource_object = TaskObject()
        else:
            resource_object = GroupObject(self._resource_type)

        resource_object.set_id(resource_id, False)  # set resource id
        if owner is not None:
            resource_object.set_owner_name(owner)  # set resource name
        if resource_name is not None:
            resource_object.set_name(resource_name, False)  # set resource name
        resource_object.set_phase(1)  # set resource api action

        # return resource object
        return self._method_wrapper(resource_object)
Example #5
0
def create_task_object(synergy_object, ccm):
    object = TaskObject(synergy_object.get_object_name(), synergy_object.get_separator(), synergy_object.get_author(), synergy_object.get_status(), synergy_object.get_created_time(), synergy_object.get_tasks())
    object.released_projects = get_projects_for_task(synergy_object, ccm)
    object.baselines = get_baselines_for_task(synergy_object, ccm)
    return object
Example #6
0
    if len(options) != 0:  # enter task the manual way
        for opt, val in options:
            if opt == "-t":  # collect task name
                task = val
            elif opt == "-d":  # collect the duedate
                duedate = val
            elif opt == "-p":  # collect the priority of task
                priority = val
            elif opt == "-h":  # display help
                showHelp()
                sys.exit(0)
            elif opt == "-f":  # force option if some options are missing
                forceOption = True

        # check if user wants to continue if they have missing options
        if forceOption and task == None or duedate == None or priority == None:
            print("Warning: Missing one or more options. Proceed?")
            proceed_opt = input()
            if "n" in proceed_opt or "N" in proceed_opt:
                sys.exit(0)

        duedate = DateTimeNLPEngine(
            duedate).parseForTime()  # obtain due date from text
        priority = DateTimeNLPEngine(
            priority).parseForPriority()  # obtain priority from text
        taskObj = TaskObject(task, duedate,
                             priority)  # create a task object for this task
        taskObj.printTask()
    else:  # enter task directly
        print("fail lol")