Creates a new instance of TaskHolder
338942
public void init(ProxyTask proxyTask, RemoteTask remoteTask)
    {
        super.init(null, remoteTask);    // TaskHolder doesn't have a parent (BaseHolder).
        m_proxyTask = proxyTask;
    }
620266
def execute(self, resource, **kw):
        
        params = kw.pop('params', {})
        json = kw.pop('json', None)
        task = self.make_request(
            TaskRunFailed,
            method='create',
            params=params,
            json=json,
            resource=resource)

        timeout = kw.pop('timeout', 5)
        wait_for_finish = kw.pop('wait_for_finish', True)
        
        return TaskOperationPoller(
            task=task, timeout=timeout,
            wait_for_finish=wait_for_finish,
            **kw)
927045
public static <Result> TaskBuilder<Result> create(Callable<Result> action,
                                                      TaskCallback<Result> callback,
                                                      Object caller) {
        return new TaskBuilder<Result>().action(action).callback(callback).with(caller);
    }
1123530
protected TaskInstance createTaskInstance() throws ActivityException {
        try {
            String taskTemplate = getAttributeValue(ATTRIBUTE_TASK_TEMPLATE);
            if (taskTemplate == null)
                throw new ActivityException("Missing attribute: " + ATTRIBUTE_TASK_TEMPLATE);
            String templateVersion = getAttributeValue(ATTRIBUTE_TASK_TEMPLATE_VERSION);
            AssetVersionSpec spec = new AssetVersionSpec(taskTemplate, templateVersion == null ? "0" : templateVersion);
            TaskTemplate template = TaskTemplateCache.getTaskTemplate(spec);
            if (template == null)
                throw new ActivityException("Task template not found: " + spec);

            String taskName = template.getTaskName();
            String title = null;
            if (ActivityRuntimeContext.isExpression(taskName)) {
                title = getRuntimeContext().evaluateToString(taskName);
            }

            String comments = null;
            Exception exception = (Exception) getVariableValue("exception");
            if (exception != null) {
                comments = exception.toString();
                if (exception instanceof ActivityException) {
                    ActivityRuntimeContext rc = ((ActivityException)exception).getRuntimeContext();
                    if (rc != null && rc.getProcess() != null) {
                        comments = rc.getProcess().getFullLabel() + "\n" + comments;
                    }
                }
            }

            return createTaskInstance(spec, getMasterRequestId(), getProcessInstanceId(),
                            getActivityInstanceId(), getWorkTransitionInstanceId(), title, comments);
        }
        catch (Exception ex) {
            throw new ActivityException(ex.getMessage(), ex);
        }
    }
42594
function createTask(taskId) {
	return function (done) {
		var stream = tasks[taskId].fn(gulp, done);
		if (stream) {
			if (stream.on) stream.on('end', done);
			if (stream.then) stream.then(done);
		}
	};
}
316002
private void initialize(Function<SqlTask, ?> onDone, CounterStat failedTasks)
    {
        requireNonNull(onDone, "onDone is null");
        requireNonNull(failedTasks, "failedTasks is null");
        taskStateMachine.addStateChangeListener(new StateChangeListener<TaskState>()
        {
            @Override
            public void stateChanged(TaskState newState)
            {
                if (!newState.isDone()) {
                    return;
                }

                // Update failed tasks counter
                if (newState == FAILED) {
                    failedTasks.update(1);
                }

                // store final task info
                while (true) {
                    TaskHolder taskHolder = taskHolderReference.get();
                    if (taskHolder.isFinished()) {
                        // another concurrent worker already set the final state
                        return;
                    }

                    if (taskHolderReference.compareAndSet(taskHolder, new TaskHolder(createTaskInfo(taskHolder), taskHolder.getIoStats()))) {
                        break;
                    }
                }

                // make sure buffers are cleaned up
                if (newState == FAILED || newState == ABORTED) {
                    // don't close buffers for a failed query
                    // closed buffers signal to upstream tasks that everything finished cleanly
                    outputBuffer.fail();
                }
                else {
                    outputBuffer.destroy();
                }

                try {
                    onDone.apply(SqlTask.this);
                }
                catch (Exception e) {
                    log.warn(e, "Error running task cleanup callback %s", SqlTask.this.taskId);
                }
            }
        });
    }
610435
public Task createDocument(Task task) {
        DocumentRevision rev = new DocumentRevision();
        rev.setBody(DocumentBodyFactory.create(task.asMap()));
        try {
            DocumentRevision created = this.mDocumentStore.database().create(rev);
            return Task.fromRevision(created);
        } catch (DocumentException de) {
            return null;
        } catch (DocumentStoreException de) {
            return null;
        }
    }
1238005
function Task(options) {
  if (!(this instanceof Task)) {
    return new Task(options);
  }

  utils.is(this, 'task');
  use(this);

  this.options = options || {};
  if (utils.isTask(options)) {
    this.options = {};
    this.addTargets(options);
    return this;
  }
}
664021
function inject (taskKey) {
    var funcName = task[taskKey]

    if (funcName === 'arguments') {
      funcs[funcName] = function getArguments () { return args }
    } else {
      var arg = regexArgument.exec(funcName)

      if (arg) {
        funcs[funcName] = getArgument.bind(null, arg[1])
      }
    }
  }
1082116
async def insert(self, task: Task) -> None:
        ''''''

        if not isinstance(task, Task):
            task = task()

        if task.name not in self.all_tasks:
            task.tasky = self
            self.all_tasks[task.name] = task

            await task.init()

        elif task != self.all_tasks[task.name]:
            raise Exception('Duplicate task %s' % task.name)

        if task.enabled:
            task.task = asyncio.ensure_future(self.start_task(task))
            self.running_tasks.add(task)
        else:
            task.task = None

        return task
555338
public Long createAndExecuteTask(String taskName, String data, String key1, String key2) {
		return tedDriverImpl.createAndExecuteTask(taskName, data, key1, key2, false);
	}
1144309
private Class instantiate(final String taskClass) {

		try {

			return Class.forName(taskClass);

		} catch (Throwable ignore) {}

		return null;
	}
262251
def create_on_task(self, task_id, file_content, file_name, file_content_type=None, **options):
        """"""
        path = '/tasks/%d/attachments' % (task_id)
        return self.client.request('post', path, files=[('file', (file_name, file_content, file_content_type))], **options)
53832
private void submitTask(@NotNull State<T, R> state, @NotNull BatchItem item, @NotNull Link auth) {
    // Submit task
    final StateHolder holder = new StateHolder(state);
    try {
      state.auth = auth;
      final Work<R> worker = objectTask(state, item);
      if (state.future.isDone()) {
        holder.close();
        return;
      }
      if (worker == null) {
        throw new IllegalStateException("Uncompleted task worker is null: " + item);
      }
      executeInPool(
          "task: " + state.getMeta().getOid(),
          () -> processObject(state, auth, worker),
          holder::close,
          true
      );
    } catch (Throwable e) {
      holder.close();
      throw e;
    }
  }
338254
static GroundyTask get(Class<? extends GroundyTask> taskClass, Context context) {
    if (CACHE.containsKey(taskClass)) {
      return CACHE.get(taskClass);
    }
    GroundyTask groundyTask = null;
    try {
      L.d(TAG, "Instantiating " + taskClass);
      Constructor ctc = taskClass.getConstructor();
      groundyTask = (GroundyTask) ctc.newInstance();
      if (groundyTask.canBeCached()) {
        CACHE.put(taskClass, groundyTask);
      } else if (CACHE.containsKey(taskClass)) {
        CACHE.remove(taskClass);
      }
      groundyTask.setContext(context);
      groundyTask.onCreate();
      return groundyTask;
    } catch (Exception e) {
      L.e(TAG, "Unable to create value for call " + taskClass, e);
    }
    return groundyTask;
  }
997441
def _getOrCreate(cls):
        
        if not isinstance(cls._taskContext, BarrierTaskContext):
            cls._taskContext = object.__new__(cls)
        return cls._taskContext
543695
private MetaHolder createCopy(MetaHolder source, ExecutionType executionType) {
        return MetaHolder.builder()
                .obj(source.getObj())
                .method(source.getMethod())
                .ajcMethod(source.getAjcMethod())
                .fallbackExecutionType(source.getFallbackExecutionType())
                .extendedFallback(source.isExtendedFallback())
                .extendedParentFallback(source.isExtendedParentFallback())
                .executionType(executionType)
                .args(source.getArgs())
                .observable(source.isObservable())
                .observableExecutionMode(source.getObservableExecutionMode())
                .defaultCollapserKey(source.getDefaultCollapserKey())
                .defaultCommandKey(source.getDefaultCommandKey())
                .defaultGroupKey(source.getDefaultGroupKey())
                .defaultThreadPoolKey(source.getDefaultThreadPoolKey())
                .defaultProperties(source.getDefaultProperties().orNull())
                .hystrixCollapser(source.getHystrixCollapser())
                .hystrixCommand(source.getHystrixCommand()).build();
    }