Adds a new assignment to this task.
@param assignTo the user to assign the assignment to.
@return information about the newly added task assignment.
341125
public BoxTaskAssignment.Info addAssignment(BoxUser assignTo) {
        JsonObject taskJSON = new JsonObject();
        taskJSON.add("type", "task");
        taskJSON.add("id", this.getID());

        JsonObject assignToJSON = new JsonObject();
        assignToJSON.add("id", assignTo.getID());

        JsonObject requestJSON = new JsonObject();
        requestJSON.add("task", taskJSON);
        requestJSON.add("assign_to", assignToJSON);

        URL url = ADD_TASK_ASSIGNMENT_URL_TEMPLATE.build(this.getAPI().getBaseURL());
        BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "POST");
        request.setBody(requestJSON.toString());
        BoxJSONResponse response = (BoxJSONResponse) request.send();
        JsonObject responseJSON = JsonObject.readFrom(response.getJSON());

        BoxTaskAssignment addedAssignment = new BoxTaskAssignment(this.getAPI(), responseJSON.get("id").asString());
        return addedAssignment.new Info(responseJSON);
    }
73377
public TaskAddOptions withOcpDate(DateTime ocpDate) {
        if (ocpDate == null) {
            this.ocpDate = null;
        } else {
            this.ocpDate = new DateTimeRfc1123(ocpDate);
        }
        return this;
    }
556368
public void addChoice (Object choice)
    {
        String name = (choice == null) ? "null" : choice.toString();
        addChoice(new Choice(name, choice));
    }
473168
public static <T> T[] addTo(T target, T[] array, ArrayCreater<T> creater) {
        T[] newArray = creater.create(array.length + 1);
        System.arraycopy(array, 0, newArray, 0, array.length);
        newArray[array.length] = target;
        return newArray;
    }
398528
public synchronized void addTask(int taskId) {
    Preconditions.checkArgument(!mTaskIdToInfo.containsKey(taskId), "");
    mTaskIdToInfo.put(taskId, new TaskInfo().setJobId(mId).setTaskId(taskId)
        .setStatus(Status.CREATED).setErrorMessage("").setResult(null));
  }
533710
public static <SOURCE, TARGET> Add<SOURCE, TARGET> to(Position.Readable<TARGET> targetPosition,
        Position.Readable<SOURCE> sourcePosition) {
        return new Add<>(sourcePosition, targetPosition);
    }
437361
public Assignment mkAssignment(TopologyAssignEvent event) throws Exception {
        String topologyId = event.getTopologyId();
        LOG.info("Determining assignment for " + topologyId);
        TopologyAssignContext context = prepareTopologyAssign(event);
        Set<ResourceWorkerSlot> assignments;
        if (!StormConfig.local_mode(nimbusData.getConf())) {
            IToplogyScheduler scheduler = schedulers.get(DEFAULT_SCHEDULER_NAME);
            assignments = scheduler.assignTasks(context);
        } else {
            assignments = mkLocalAssignment(context);
        }

        Assignment assignment = null;
        if (assignments != null && assignments.size() > 0) {
            Map<String, String> nodeHost = getTopologyNodeHost(
                    context.getCluster(), context.getOldAssignment(), assignments);
            Map<Integer, Integer> startTimes = getTaskStartTimes(
                    context, nimbusData, topologyId, context.getOldAssignment(), assignments);

            String codeDir = (String) nimbusData.getConf().get(Config.STORM_LOCAL_DIR);

            assignment = new Assignment(codeDir, assignments, nodeHost, startTimes);

            //  the topology binary changed.
            if (event.isScaleTopology()) {
                assignment.setAssignmentType(Assignment.AssignmentType.ScaleTopology);
            }
            StormClusterState stormClusterState = nimbusData.getStormClusterState();

            stormClusterState.set_assignment(topologyId, assignment);

            // update task heartbeat's start time
            NimbusUtils.updateTaskHbStartTime(nimbusData, assignment, topologyId);

            // Update metrics information in ZK when rebalance or reassignment
            // Only update metrics monitor status when creating topology
            // if (context.getAssignType() ==
            // TopologyAssignContext.ASSIGN_TYPE_REBALANCE
            // || context.getAssignType() ==
            // TopologyAssignContext.ASSIGN_TYPE_MONITOR)
            // NimbusUtils.updateMetricsInfo(nimbusData, topologyId, assignment);

            NimbusUtils.updateTopologyTaskTimeout(nimbusData, topologyId);

            LOG.info("Successfully make assignment for topology id " + topologyId + ": " + assignment);
        }
        return assignment;
    }
1271960
@Override public Task addTask()
   {
      ProjectFile parent = getParentFile();

      Task task = new Task(parent, this);

      m_children.add(task);

      parent.getTasks().add(task);

      setSummary(true);

      return (task);
   }
1300822
@Override
  public int compareTo(ID o) {
    TaskAttemptID that = (TaskAttemptID)o;
    int tipComp = this.taskId.compareTo(that.taskId);
    if(tipComp == 0) {
      return this.id - that.id;
    }
    else return tipComp;
  }
793048
def add(self, task):
        
        wait_id = task.wait_for_task_id
        task_list = self.wait_id_to_task.get(wait_id, [])
        task_list.append(task)
        self.wait_id_to_task[wait_id] = task_list
592175
public ItemRequest<Task> addFollowers(String task) {
    
        String path = String.format("/tasks/%s/addFollowers", task);
        return new ItemRequest<Task>(this, Task.class, path, "POST");
    }
1121834
public void addNestedDTO(JavaClass<?> entity, JavaClassSource nestedDTO)
   {
      DTOPair dtoPair = dtos.containsKey(entity) ? dtos.get(entity) : new DTOPair();
      dtoPair.nestedDTO = nestedDTO;
      dtos.put(entity, dtoPair);
   }
944720
private void writeAssignment(ResourceAssignment mpxj)
   {
      ResourceAssignmentType xml = m_factory.createResourceAssignmentType();
      m_project.getResourceAssignment().add(xml);
      Task task = mpxj.getTask();
      Task parentTask = task.getParentTask();
      Integer parentTaskUniqueID = parentTask == null ? null : parentTask.getUniqueID();

      xml.setActivityObjectId(mpxj.getTaskUniqueID());
      xml.setActualCost(getDouble(mpxj.getActualCost()));
      xml.setActualFinishDate(mpxj.getActualFinish());
      xml.setActualOvertimeUnits(getDuration(mpxj.getActualOvertimeWork()));
      xml.setActualRegularUnits(getDuration(mpxj.getActualWork()));
      xml.setActualStartDate(mpxj.getActualStart());
      xml.setActualUnits(getDuration(mpxj.getActualWork()));
      xml.setAtCompletionUnits(getDuration(mpxj.getRemainingWork()));
      xml.setPlannedCost(getDouble(mpxj.getActualCost()));
      xml.setFinishDate(mpxj.getFinish());
      xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
      xml.setObjectId(mpxj.getUniqueID());
      xml.setPlannedDuration(getDuration(mpxj.getWork()));
      xml.setPlannedFinishDate(mpxj.getFinish());
      xml.setPlannedStartDate(mpxj.getStart());
      xml.setPlannedUnits(getDuration(mpxj.getWork()));
      xml.setPlannedUnitsPerTime(getPercentage(mpxj.getUnits()));
      xml.setProjectObjectId(PROJECT_OBJECT_ID);
      xml.setRateSource("Resource");
      xml.setRemainingCost(getDouble(mpxj.getActualCost()));
      xml.setRemainingDuration(getDuration(mpxj.getRemainingWork()));
      xml.setRemainingFinishDate(mpxj.getFinish());
      xml.setRemainingStartDate(mpxj.getStart());
      xml.setRemainingUnits(getDuration(mpxj.getRemainingWork()));
      xml.setRemainingUnitsPerTime(getPercentage(mpxj.getUnits()));
      xml.setResourceObjectId(mpxj.getResourceUniqueID());
      xml.setStartDate(mpxj.getStart());
      xml.setWBSObjectId(parentTaskUniqueID);
      xml.getUDF().addAll(writeUDFType(FieldTypeClass.ASSIGNMENT, mpxj));
   }
259544
private void addAssignments(MpxjTreeNode parentNode, ProjectFile file)
   {
      for (ResourceAssignment assignment : file.getResourceAssignments())
      {
         final ResourceAssignment a = assignment;
         MpxjTreeNode childNode = new MpxjTreeNode(a)
         {
            @Override public String toString()
            {
               Resource resource = a.getResource();
               String resourceName = resource == null ? "(unknown resource)" : resource.getName();
               Task task = a.getTask();
               String taskName = task == null ? "(unknown task)" : task.getName();
               return resourceName + "->" + taskName;
            }
         };
         parentNode.add(childNode);
      }
   }
1117234
def _assign(self, assignment):  # type: (Assignment) -> None
        
        self._assignments.append(assignment)
        self._register(assignment)
1222491
def put_task(self, task):
        ''''''
        _schedule = task.get('schedule', self.default_schedule)
        self.projects[task['project']].task_queue.put(
            task['taskid'],
            priority=_schedule.get('priority', self.default_schedule['priority']),
            exetime=_schedule.get('exetime', self.default_schedule['exetime'])
        )
116636
def task_assignments(self):
        ''''''
        url = str.format(
            'projects/{}/task_assignments',
            self.id
        )
        response = self.hv.get_request(url)
        return [TaskAssignment(self.hv, tj['task_assignment']) for tj in response]