Create a new task that’s part of the group. Returns a Task
        instance.
775676
async def spawn(self, coro, *args):
        '''
        '''
        task = await spawn(coro, *args, report_crash=False)
        self._add_task(task)
        return task
1233299
def addTask(self, task):
        
        # Try to start task first.  If it fails then we don't need to
        # undo adding it to taskset
        task.initialize(self)
        task.start()

        with self._lock_c:
            self.numtasks += 1
            self.taskset.append(task)
304858
def run_task(task_cls, task_data):
    
    task = instantiate(task_cls)
    task_callable = get_callable(task)
    return task_callable(TaskData(task_data))
6488
def create_task(self, target: Callable[..., Any], *args: Any)\
            -> asyncio.tasks.Task:
        """"""
        if asyncio.iscoroutine(target):
            task = self._loop.create_task(target)
        elif asyncio.iscoroutinefunction(target):
            task = self._loop.create_task(target(*args))
        else:
            raise ValueError("Expected coroutine as target")
        self._pending_tasks.append(task)
        return task
647991
def add(self, target, args=None, kwargs=None, **options):
        

        # In superclass, add new task to our list of tasks
        target = super(
            AutoContext, self).add(target, args, kwargs, **options)

        self._auto_insert_check()

        return target
581984
def creategroup(self, name, path, **kwargs):
        
        data = {'name': name, 'path': path}

        if kwargs:
            data.update(kwargs)

        request = requests.post(
            self.groups_url, data=data, headers=self.headers,
            verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)

        if request.status_code == 201:
            return request.json()
        else:
            msg = request.json()['message']
            raise exceptions.HttpError(msg)
1193784
def shot_create_task(self, *args, **kwargs):
        
        if not self.cur_shot:
            return
        task = self.create_task(element=self.cur_shot)
        if task:
            taskdata = djitemdata.TaskItemData(task)
            treemodel.TreeItem(taskdata, self.shot_task_model.root)
1201598
def add(name, **kwargs):
    '''
    
    '''
    if not info(name):
        comp_obj = _get_computer_object()
        try:
            new_group = comp_obj.Create('group', name)
            new_group.SetInfo()
            log.info('Successfully created group %s', name)
        except pywintypes.com_error as exc:
            msg = 'Failed to create group {0}. {1}'.format(
                name, win32api.FormatMessage(exc.excepinfo[5]))
            log.error(msg)
            return False
    else:
        log.warning('The group %s already exists.', name)
        return False
    return True
1252821
def create_tasks(self):
        
        roles = self.get_roles()

        if self.task_type in ["A", "D"]:
            instances = self.create_wf_instances(roles=roles)
            self.create_task_invitation(instances)

        elif self.task_type in ["C", "B"]:
            instances = self.create_wf_instances()
            self.create_task_invitation(instances, roles)
659896
def CreateRetryTask(self):
    
    with self._lock:
      abandoned_task = self._GetTaskPendingRetry()
      if not abandoned_task:
        return None

      # The abandoned task is kept in _tasks_abandoned so it can be still
      # identified in CheckTaskToMerge and UpdateTaskAsPendingMerge.

      retry_task = abandoned_task.CreateRetryTask()
      logger.debug('Retrying task {0:s} as {1:s}.'.format(
          abandoned_task.identifier, retry_task.identifier))

      self._tasks_queued[retry_task.identifier] = retry_task
      self._total_number_of_tasks += 1

      self.SampleTaskStatus(retry_task, 'created_retry')

      return retry_task
1342061
static TaskInstance createTaskInstance(Long taskId, String masterOwnerId,
            String title, String comment, Instant due, Long userId, Long secondaryOwner)
    throws ServiceException, DataAccessException {
        CodeTimer timer = new CodeTimer("createTaskInstance()", true);
        TaskTemplate task = TaskTemplateCache.getTaskTemplate(taskId);
        TaskInstance ti = createTaskInstance(taskId,  masterOwnerId, OwnerType.USER, userId,
                (secondaryOwner != null ? OwnerType.DOCUMENT : null), secondaryOwner,
                task.getTaskName(), title, comment, due, 0);

        TaskWorkflowHelper helper = new TaskWorkflowHelper(ti);

        if (due!=null) {
            String alertIntervalString = task.getAttribute(TaskAttributeConstant.ALERT_INTERVAL);
            int alertInterval = StringHelper.isEmpty(alertIntervalString) ? 0 : Integer.parseInt(alertIntervalString);
            helper.scheduleTaskSlaEvent(Date.from(due), alertInterval, false);
        }
        // create instance groups for template based tasks
        List<String> groups = helper.determineWorkgroups(null);
        if (groups != null && groups.size() > 0)
            new TaskDataAccess().setTaskInstanceGroups(ti.getTaskInstanceId(), StringHelper.toStringArray(groups));

        helper.notifyTaskAction(TaskAction.CREATE, null, null);   // notification/observer/auto-assign
        helper.auditLog("Create", "MDW");
        timer.stopAndLogTiming("");
        return ti;
    }
665656
def task_add(self, subsystem, name, pid):
        

        args = {
            'subsystem': subsystem,
            'name': name,
            'pid': pid,
        }

        self._task_chk.check(args)
        return self._client.json('cgroup.task-add', args)
862551
def group_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/groups.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
238964
protected function createTask()
    {
        $task = \call_user_func_array(['parent', 'task'], \func_get_args());
        $task->setInput($this->input());
        $task->setOutput($this->output());

        return $task;
    }
906363
def create_task(client, list_id, title, assignee_id=None, completed=None, recurrence_type=None, recurrence_count=None, due_date=None, starred=None):
    ''' 
    
    '''
    _check_title_length(title, client.api)
    if (recurrence_type is None and recurrence_count is not None) or (recurrence_type is not None and recurrence_count is None):
        raise ValueError("recurrence_type and recurrence_count are required are required together")
    if due_date is not None:
        _check_date_format(due_date, client.api)
    data = {
            'list_id' : int(list_id) if list_id else None,
            'title' : title,
            'assignee_id' : int(assignee_id) if assignee_id else None,
            'completed' : completed,
            'recurrence_type' : recurrence_type,
            'recurrence_count' : int(recurrence_count) if recurrence_count else None,
            'due_date' : due_date,
            'starred' : starred,
            }
    data = { key: value for key, value in data.items() if value is not None }
    response = client.authenticated_request(client.api.Endpoints.TASKS, 'POST', data=data)
    return response.json()
1015449
def _create_safe_task(self, coroutine):
        
        task = self._loop.create_task(coroutine)
        task.add_done_callback(self.__log_safe_task)
        return task
262349
public function create(Task $task): Task
    {
        $response = $this->client->post($this->prepareUrlForKey('add-task'), [], $task->jsonSerialize());
        $responseData = $response->getDecodedBody();

        return new Task($responseData);
    }