Select a worker to build a bulding with.
774995
def select_build_worker(self, pos: Union[Unit, Point2, Point3], force: bool=False) -> Optional[Unit]:
        """"""

        workers = self.workers.closer_than(20, pos) or self.workers
        for worker in workers.prefer_close_to(pos).prefer_idle:
            if not worker.orders or len(worker.orders) == 1 and worker.orders[0].ability.id in {AbilityId.MOVE,
                                                                                                AbilityId.HARVEST_GATHER,
                                                                                                AbilityId.HARVEST_RETURN}:
                return worker

        return workers.random if force else None
339752
def build(self, builder):
        """"""
        params = {}
        if self.lang is not None:
            params["xml:lang"] = self.lang
        builder.start("TranslatedText", params)
        builder.data(self.text)
        builder.end("TranslatedText")
293895
public WorkflowTaskCoordinator build() {
			if(taskWorkers == null) {
				throw new IllegalArgumentException("No task workers are specified. use withWorkers() to add one mor more task workers");
			}

			if(taskClient == null) {
				throw new IllegalArgumentException("No TaskClient provided. use withTaskClient() to provide one");
			}
			return new WorkflowTaskCoordinator(eurekaClient, taskClient, threadCount, sleepWhenRetry, updateRetryCount,
											   workerQueueSize, taskWorkers, workerNamePrefix);
		}
1122418
public function build()
    {
        $workflow = new Workflow($this->workflowId, $this->workflowName);

        foreach ($this->roles as $id => $role) {
            list($name) = $role;
            $workflow->addRole(new Role($id, $name));
        }

        foreach ($this->startEvents as $id => $event) {
            list($roleId, $name) = $event;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new StartEvent($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->endEvents as $id => $event) {
            list($roleId, $name) = $event;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new EndEvent($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->tasks as $id => $task) {
            list($roleId, $name) = $task;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new Task($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->serviceTasks as $id => $task) {
            list($roleId, $operation, $name) = $task;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new ServiceTask($id, $workflow->getRole($roleId), $operation, $name));
        }

        foreach ($this->sendTasks as $id => $task) {
            list($roleId, $message, $operation, $name) = $task;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new SendTask($id, $workflow->getRole($roleId), $message, $operation, $name));
        }

        foreach ($this->exclusiveGateways as $id => $gateway) {
            list($roleId, $name) = $gateway;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new ExclusiveGateway($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->sequenceFlows as $id => $flow) {
            list($source, $destination, $name, $condition) = $flow;

            if (array_key_exists($id, $this->defaultableFlowObjects) && $condition !== null) {
                throw new \LogicException(sprintf('The sequence flow "%s" has the condition "%s". A condition cannot be set to the default sequence flow.', $id, $condition));
            }

            $flowObject = $workflow->getFlowObject($source); /* @var $flowObject TransitionalInterface */
            $workflow->addConnectingObject(new SequenceFlow($id, $flowObject, $workflow->getFlowObject($destination), $name, $condition === null ? null : new Expression($condition)));

            if (array_key_exists($id, $this->defaultableFlowObjects)) {
                $flowObject = $workflow->getFlowObject($this->defaultableFlowObjects[$id]);
                /* @var $flowObject ConditionalInterface */$flowObject->setDefaultSequenceFlowId($id);
            }
        }

        return $workflow;
    }
801408
public static Builder build(String name, String help) {
    return new Builder().name(name).help(help);
  }
278776
def worker(namespace, name, branch='master'):
    ''''''
    with repository(namespace, name, branch) as (path, latest, cache):
        if cache.get(latest, None) and json.loads(cache[latest])['status'] != 'starting':
            return 'Build already started'

        data = {'status': 'in_progress', 'result': ''}
        cache[latest] = json.dumps(data)
        test_output = tox(_iter=True)
        try:
            for line in test_output:
                data['result'] += line
                cache[latest] = json.dumps(data)
            data['build_success'] = True
        except Exception:
            data['build_success'] = False
        data['status'] = 'complete'
        cache[latest] = json.dumps(data)
        return 'Build successfully completed'
1307581
def build(self, **kw):
        """"""
        global MkdirBuilder
        if self.builder is not MkdirBuilder:
            SCons.Node.Node.build(self, **kw)
906848
def detached(self, worker):
        """"""
        for wfb in self.attaching_workers + self.workers:
            if wfb.worker == worker:
                break
        else:
            log.msg("WEIRD: Builder.detached(%s) (%s)"
                    " not in attaching_workers(%s)"
                    " or workers(%s)" % (worker, worker.workername,
                                         self.attaching_workers,
                                         self.workers))
            return

        if wfb in self.attaching_workers:
            self.attaching_workers.remove(wfb)
        if wfb in self.workers:
            self.workers.remove(wfb)

        # inform the WorkerForBuilder that their worker went away
        wfb.detached()
1123902
def create_job(self,
                   builder_job,    # type: Dict[Text, Any]
                   wf_job=None,    # type: Callable[[Dict[Text, Text], Callable[[Any, Any], Any], RuntimeContext], Generator[Any, None, None]]
                   is_output=False
                  ):  # type: (...) -> Dict
        #TODO customise the file
        """"""
        copied = copy.deepcopy(builder_job)
        relativised_input_objecttemp = {}  # type: Dict[Text, Any]
        self._relativise_files(copied)
        def jdefault(o):
            return dict(o)
        if is_output:
            rel_path = posixpath.join(_posix_path(WORKFLOW), "primary-output.json")
        else:
            rel_path = posixpath.join(_posix_path(WORKFLOW), "primary-job.json")
        j = json_dumps(copied, indent=4, ensure_ascii=False, default=jdefault)
        with self.write_bag_file(rel_path) as file_path:
            file_path.write(j + u"\n")
        _logger.debug(u"[provenance] Generated customised job file: %s",
                      rel_path)
        # Generate dictionary with keys as workflow level input IDs and values
        # as
        # 1) for files the relativised location containing hash
        # 2) for other attributes, the actual value.
        relativised_input_objecttemp = {}
        for key, value in copied.items():
            if isinstance(value, MutableMapping):
                if value.get("class") in ("File", "Directory"):
                    relativised_input_objecttemp[key] = value
            else:
                relativised_input_objecttemp[key] = value
        self.relativised_input_object.update(
            {k: v for k, v in relativised_input_objecttemp.items() if v})
        return self.relativised_input_object
89499
def build(self, builder):
        """"""
        params = dict(StudyEventOID=self.oid, Mandatory=bool_to_yes_no(self.mandatory))
        if self._order_number is not None:
            params["OrderNumber"] = self._order_number
        builder.start("StudyEventRef", params)
        builder.end("StudyEventRef")
889027
def build(self, builder):
        
        builder.start("Question", {})
        for translation in self.translations:
            translation.build(builder)
        builder.end("Question")
1018590
def _startProductionCrewNode(self, name, attrs):
        """"""

        if name == 'crew':
            self._programId = attrs.get('program')
        elif name == 'member':
            self._role = None
            self._givenname = None
            self._surname = None
166194
function (jobName, buildNumber, customParams, callback) {
      [jobName, buildNumber, customParams, callback] = doArgs(arguments, ['string', 'string|number', ['object', {}], 'function']);

      doRequest({
        urlPattern: [BUILD_INFO, jobName, buildNumber]
      }, customParams, callback);
    }
1174344
def join(self):
        """"""
        for thread in self.worker_threads:
            thread.join()
        WorkerThread.join(self)
336056
def build(self):
        """"""

        # If there's no output tube, it means that this stage
        # is at the end of a fork (hasn't been linked to any stage downstream).
        # Therefore, create one output tube.
        if not self._output_tubes:
            self._output_tubes.append(self._worker_class.getTubeClass()())

        self._worker_class.assemble(
            self._worker_args,
            self._input_tube,
            self._output_tubes,
            self._size,
            self._disable_result,
            self._do_stop_task,
            )

        # Build all downstream stages.
        for stage in self._next_stages:
            stage.build()
976875
def cpp_prog_builder(build_context, target):
    """"""
    yprint(build_context.conf, 'Build CppProg', target)
    workspace_dir = build_context.get_workspace('CppProg', target.name)
    build_cpp(build_context, target, target.compiler_config, workspace_dir)
987492
def build(self, builder):
        """"""
        params = dict(
            OID=self.oid,
            Active=bool_to_true_false(self.active),
            BypassDuringMigration=bool_to_true_false(self.bypass_during_migration),
            NeedsRetesting=bool_to_true_false(self.needs_retesting),
        )

        if self.variable_oid is not None:
            params["VariableOID"] = self.variable_oid

        if self.field_oid is not None:
            params["FieldOID"] = self.field_oid

        if self.form_oid is not None:
            params["FormOID"] = self.form_oid

        if self.folder_oid is not None:
            params["FolderOID"] = self.folder_oid

        if self.record_position is not None:
            params["RecordPosition"] = str(self.record_position)

        if self.form_repeat_number is not None:
            params["FormRepeatNumber"] = str(self.form_repeat_number)

        if self.folder_repeat_number is not None:
            params["FolderRepeatNumber"] = str(self.folder_repeat_number)

        if self.all_variables_in_folders is not None:
            params["AllVariablesInFolders"] = bool_to_true_false(
                self.all_variables_in_folders
            )

        if self.all_variables_in_fields is not None:
            params["AllVariablesInFields"] = bool_to_true_false(
                self.all_variables_in_fields
            )

        if self.logical_record_position is not None:
            params["LogicalRecordPosition"] = self.logical_record_position.value

        builder.start("mdsol:DerivationDef", params)
        for step in self.derivation_steps:
            step.build(builder)
        builder.end("mdsol:DerivationDef")