Search in sources :

Example 1 with CloudAppConfiguration

use of com.dangdang.ddframe.job.cloud.scheduler.config.app.CloudAppConfiguration in project elastic-job by dangdangdotcom.

the class TaskLaunchScheduledService method getTaskInfo.

private Protos.TaskInfo getTaskInfo(final Protos.SlaveID slaveID, final TaskAssignmentResult taskAssignmentResult) {
    TaskContext taskContext = TaskContext.from(taskAssignmentResult.getTaskId());
    Optional<CloudJobConfiguration> jobConfigOptional = facadeService.load(taskContext.getMetaInfo().getJobName());
    if (!jobConfigOptional.isPresent()) {
        return null;
    }
    CloudJobConfiguration jobConfig = jobConfigOptional.get();
    Optional<CloudAppConfiguration> appConfigOptional = facadeService.loadAppConfig(jobConfig.getAppName());
    if (!appConfigOptional.isPresent()) {
        return null;
    }
    CloudAppConfiguration appConfig = appConfigOptional.get();
    taskContext.setSlaveId(slaveID.getValue());
    ShardingContexts shardingContexts = getShardingContexts(taskContext, appConfig, jobConfig);
    boolean useDefaultExecutor = CloudJobExecutionType.TRANSIENT == jobConfig.getJobExecutionType() && JobType.SCRIPT == jobConfig.getTypeConfig().getJobType();
    Protos.CommandInfo.URI uri = buildURI(appConfig, useDefaultExecutor);
    Protos.CommandInfo command = buildCommand(uri, appConfig.getBootstrapScript(), shardingContexts, useDefaultExecutor);
    return buildTaskInfo(taskContext, appConfig, jobConfig, shardingContexts, slaveID, command, useDefaultExecutor);
}
Also used : CloudAppConfiguration(com.dangdang.ddframe.job.cloud.scheduler.config.app.CloudAppConfiguration) TaskContext(com.dangdang.ddframe.job.context.TaskContext) CloudJobConfiguration(com.dangdang.ddframe.job.cloud.scheduler.config.job.CloudJobConfiguration) Protos(org.apache.mesos.Protos) ShardingContexts(com.dangdang.ddframe.job.executor.ShardingContexts)

Aggregations

CloudAppConfiguration (com.dangdang.ddframe.job.cloud.scheduler.config.app.CloudAppConfiguration)1 CloudJobConfiguration (com.dangdang.ddframe.job.cloud.scheduler.config.job.CloudJobConfiguration)1 TaskContext (com.dangdang.ddframe.job.context.TaskContext)1 ShardingContexts (com.dangdang.ddframe.job.executor.ShardingContexts)1 Protos (org.apache.mesos.Protos)1