Takes in an instance of {@link CloudTask}, generates and triggers a
{@link org.apache.reef.runtime.common.driver.resourcemanager.ResourceStatusEvent}.

@param cloudTask and instance of {@link CloudTask}.
326432
public void onAzureBatchTaskStatus(final CloudTask cloudTask) {
    ResourceStatusEventImpl.Builder eventBuilder =
        ResourceStatusEventImpl.newBuilder()
            .setIdentifier(cloudTask.id())
            .setState(TaskStatusMapper.getReefTaskState(cloudTask))
            .setRuntimeName(RuntimeIdentifier.RUNTIME_NAME);

    if (TaskState.COMPLETED.equals(cloudTask.state())) {
      eventBuilder.setExitCode(cloudTask.executionInfo().exitCode());
    }

    this.reefEventHandlers.onResourceStatus(eventBuilder.build());
  }
168493
@Override
	public void registerTaskEventListener(EventListener<TaskEvent> listener, Class<? extends TaskEvent> eventType) {
		taskEventHandler.subscribe(listener, eventType);
	}
1322565
public static void invokeTask (String name, Task task, TaskObserver observer)
    {
        // create a task runner and stick it in our task table
        TaskRunner runner = new TaskRunner(name, task, observer);
        _tasks.put(name, runner);
        // then start the runner up
        runner.start();
    }
834860
def run(cluster, started_by: nil, **args)
      overrides_json = json_generator.generate_override_json(**args)
      info = Ecs.run_task(cluster.name, register,
                          started_by: started_by,
                          overrides_json: overrides_json)
      info.fetch("tasks")[0].fetch("taskArn")
    end
225352
@Override
  public void onNext(final ResourceLaunchEvent resourceLaunchEvent) {
    LOG.log(Level.FINEST, "Got ResourceLaunchEvent in AzureBatchResourceLaunchHandler");
    this.azureBatchResourceManager.onResourceLaunched(resourceLaunchEvent);
  }
256563
private void submitTaskStateEvent(TaskState taskState, Map<String, String> jobMetadata) {
    ImmutableMap.Builder<String, String> taskMetadataBuilder = new ImmutableMap.Builder<>();

    taskMetadataBuilder.putAll(jobMetadata);
    taskMetadataBuilder.put(METADATA_TASK_ID, taskState.getTaskId());
    taskMetadataBuilder.put(METADATA_TASK_START_TIME, Long.toString(taskState.getStartTime()));
    taskMetadataBuilder.put(METADATA_TASK_END_TIME, Long.toString(taskState.getEndTime()));
    taskMetadataBuilder.put(METADATA_TASK_WORKING_STATE, taskState.getWorkingState().toString());
    taskMetadataBuilder.put(METADATA_TASK_FAILURE_CONTEXT, taskState.getTaskFailureException().or(UNKNOWN_VALUE));
    taskMetadataBuilder.put(EventSubmitter.EVENT_TYPE, TASK_STATE);

    this.eventSubmitter.submit(TASK_STATE, taskMetadataBuilder.build());
  }
338942
public void init(ProxyTask proxyTask, RemoteTask remoteTask)
    {
        super.init(null, remoteTask);    // TaskHolder doesn't have a parent (BaseHolder).
        m_proxyTask = proxyTask;
    }
807972
private void executeTask(DataSourceJdbcTask jdbcTask) {
		JdbcActivity jdbcActivity = jdbcRA.createActivity();
		ActivityContextInterface jdbcACI = jdbcACIF
				.getActivityContextInterface(jdbcActivity);
		jdbcACI.attach(sbbContextExt.getSbbLocalObject());
		jdbcActivity.execute(jdbcTask);
	}
908246
public void setTaskSets(java.util.Collection<String> taskSets) {
        if (taskSets == null) {
            this.taskSets = null;
            return;
        }

        this.taskSets = new com.amazonaws.internal.SdkInternalList<String>(taskSets);
    }
88047
public void executeSystemTask(WorkflowSystemTask systemTask, String taskId, int unackTimeout) {
        try {
            Task task = executionDAOFacade.getTaskById(taskId);
            if (task == null) {
                LOGGER.error("TaskId: {} could not be found while executing SystemTask", taskId);
                return;
            }
            LOGGER.info("Task: {} fetched from execution DAO for taskId: {}", task, taskId);
            if (task.getStatus().isTerminal()) {
                //Tune the SystemTaskWorkerCoordinator's queues - if the queue size is very big this can happen!
                LOGGER.info("Task {}/{} was already completed.", task.getTaskType(), task.getTaskId());
                queueDAO.remove(QueueUtils.getQueueName(task), task.getTaskId());
                return;
            }

            String workflowId = task.getWorkflowInstanceId();
            Workflow workflow = executionDAOFacade.getWorkflowById(workflowId, true);

            if (task.getStartTime() == 0) {
                task.setStartTime(System.currentTimeMillis());
                Monitors.recordQueueWaitTime(task.getTaskDefName(), task.getQueueWaitTime());
            }

            if (workflow.getStatus().isTerminal()) {
                LOGGER.warn("Workflow {} has been completed for {}/{}", workflow.getWorkflowId(), systemTask.getName(), task.getTaskId());
                if (!task.getStatus().isTerminal()) {
                    task.setStatus(CANCELED);
                }
                executionDAOFacade.updateTask(task);
                queueDAO.remove(QueueUtils.getQueueName(task), task.getTaskId());
                return;
            }

            if (task.getStatus().equals(SCHEDULED)) {
                if (executionDAOFacade.exceedsInProgressLimit(task)) {
                    //to do add a metric to record this
                    LOGGER.warn("Concurrent Execution limited for {}:{}", taskId, task.getTaskDefName());
                    return;
                }
                if (task.getRateLimitPerFrequency() > 0 && executionDAOFacade.exceedsRateLimitPerFrequency(task)) {
                    LOGGER.warn("RateLimit Execution limited for {}:{}, limit:{}", taskId, task.getTaskDefName(), task.getRateLimitPerFrequency());
                    return;
                }
            }

            LOGGER.info("Executing {}/{}-{}", task.getTaskType(), task.getTaskId(), task.getStatus());

            queueDAO.setUnackTimeout(QueueUtils.getQueueName(task), task.getTaskId(), systemTask.getRetryTimeInSecond() * 1000);
            task.setPollCount(task.getPollCount() + 1);
            executionDAOFacade.updateTask(task);

            switch (task.getStatus()) {
                case SCHEDULED:
                    systemTask.start(workflow, task, this);
                    break;

                case IN_PROGRESS:
                    systemTask.execute(workflow, task, this);
                    break;
                default:
                    break;
            }

            if (!task.getStatus().isTerminal()) {
                task.setCallbackAfterSeconds(unackTimeout);
            }

            updateTask(new TaskResult(task));
            LOGGER.info("Done Executing {}/{}-{} op={}", task.getTaskType(), task.getTaskId(), task.getStatus(), task.getOutputData().toString());

        } catch (Exception e) {
            LOGGER.error("Error executing system task - {}, with id: {}", systemTask, taskId, e);
        }
    }
341169
public ServiceFuture<List<ClusterInner>> listAsync(final ServiceCallback<List<ClusterInner>> serviceCallback) {
        return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback);
    }
444214
@TaskAction
  public void checkCloudSdkAction()
      throws CloudSdkNotFoundException, CloudSdkVersionFileException, CloudSdkOutOfDateException,
          AppEngineJavaComponentsNotInstalledException {
    // These properties are only set by AppEngineCorePluginConfiguration if the correct config
    // params are set in the tools extension.
    if (Strings.isNullOrEmpty(version) || cloudSdk == null) {
      throw new GradleException(
          "Cloud SDK home path and version must be configured in order to run this task.");
    }

    if (!version.equals(cloudSdk.getVersion().toString())) {
      throw new GradleException(
          "Specified Cloud SDK version ("
              + version
              + ") does not match installed version ("
              + cloudSdk.getVersion()
              + ").");
    }

    cloudSdk.validateCloudSdk();
    if (requiresAppEngineJava) {
      cloudSdk.validateAppEngineJavaComponents();
    }
  }
406448
@Override
    public java.util.concurrent.Future<ListTagsForResourceResult> listTagsForResourceAsync(
            com.amazonaws.handlers.AsyncHandler<ListTagsForResourceRequest, ListTagsForResourceResult> asyncHandler) {

        return listTagsForResourceAsync(new ListTagsForResourceRequest(), asyncHandler);
    }
1327203
void startTaskTrackers(ClusterStory clusterStory, long now) {
    /** port assigned to TTs, incremented by 1 for each TT */
    int port = 10000;
    long ms = now + 100;

    for (MachineNode node : clusterStory.getMachines()) {
      String hostname = node.getName();
      RackNode rackNode = node.getRackNode();
      StaticMapping.addNodeToRack(hostname, rackNode.getName());
      String taskTrackerName = "tracker_" + hostname + ":localhost/127.0.0.1:"
          + port;
      port++;
      SimulatorTaskTracker tt = new SimulatorTaskTracker(jt, taskTrackerName,
          hostname, node.getMapSlots(), node.getReduceSlots());
      queue.addAll(tt.init(ms++));
    }
  }
785122
public synchronized void executeTaskWithUnifiedListener(@NonNull DownloadTask task,
                                                            @NonNull DownloadListener listener) {
        attachListener(task, listener);

        task.execute(hostListener);
    }
509609
private synchronized void runTask(Task task) {
        if (taskThread == null) {
            taskThread = new TaskThread();
        }
        taskThread.runTask(task);
    }
960101
public void setExportTasks(java.util.Collection<ExportTask> exportTasks) {
        if (exportTasks == null) {
            this.exportTasks = null;
            return;
        }

        this.exportTasks = new com.amazonaws.internal.SdkInternalList<ExportTask>(exportTasks);
    }