Search in sources :

Example 86 with Config

use of edu.iu.dsc.tws.api.config.Config in project twister2 by DSC-SPIDAL.

the class NomadWorkerStarter method loadConfigurations.

private Config loadConfigurations(CommandLine cmd, int id) {
    String twister2Home = cmd.getOptionValue("twister2_home");
    String container = cmd.getOptionValue("container_class");
    String configDir = cmd.getOptionValue("config_dir");
    String clusterType = cmd.getOptionValue("cluster_type");
    String jobID = cmd.getOptionValue("job_id");
    LOG.log(Level.FINE, String.format("Initializing process with " + "twister_home: %s container_class: %s config_dir: %s cluster_type: %s", twister2Home, container, configDir, clusterType));
    Config cfg = ConfigLoader.loadConfig(twister2Home, configDir, clusterType);
    Config workerConfig = Config.newBuilder().putAll(cfg).put(SchedulerContext.TWISTER2_HOME.getKey(), twister2Home).put(SchedulerContext.WORKER_CLASS, container).put(SchedulerContext.TWISTER2_CONTAINER_ID, id).put(SchedulerContext.TWISTER2_CLUSTER_TYPE, clusterType).build();
    String jobDescFile = JobUtils.getJobDescriptionFilePath(jobID, workerConfig);
    job = JobUtils.readJobFile(jobDescFile);
    job.getNumberOfWorkers();
    Config updatedConfig = JobUtils.overrideConfigs(job, cfg);
    updatedConfig = Config.newBuilder().putAll(updatedConfig).put(SchedulerContext.TWISTER2_HOME.getKey(), twister2Home).put(SchedulerContext.WORKER_CLASS, container).put(SchedulerContext.TWISTER2_CONTAINER_ID, id).put(SchedulerContext.TWISTER2_CLUSTER_TYPE, clusterType).put(SchedulerContext.JOB_ID, job.getJobId()).put(SchedulerContext.JOB_NAME, job.getJobName()).build();
    return updatedConfig;
}
Also used : Config(edu.iu.dsc.tws.api.config.Config)

Example 87 with Config

use of edu.iu.dsc.tws.api.config.Config in project twister2 by DSC-SPIDAL.

the class MPIWorkerStarter method loadConfigurations.

private Config loadConfigurations(CommandLine cmd) {
    String twister2Home = cmd.getOptionValue("twister2_home");
    String configDir = cmd.getOptionValue("config_dir");
    String clusterType = cmd.getOptionValue("cluster_type");
    String jobId = cmd.getOptionValue("job_id");
    String jIp = cmd.getOptionValue("job_master_ip");
    int jPort = Integer.parseInt(cmd.getOptionValue("job_master_port"));
    boolean restoreJob = Boolean.parseBoolean(cmd.getOptionValue("restore_job"));
    restartCount = Integer.parseInt(cmd.getOptionValue("restart_count"));
    Config cfg = ConfigLoader.loadConfig(twister2Home, configDir, clusterType);
    Config workerConfig = Config.newBuilder().putAll(cfg).put(MPIContext.TWISTER2_HOME.getKey(), twister2Home).put(MPIContext.TWISTER2_CONTAINER_ID, globalRank).put(MPIContext.TWISTER2_CLUSTER_TYPE, clusterType).build();
    String jobDescFile = JobUtils.getJobDescriptionFilePath(jobId, workerConfig);
    job = JobUtils.readJobFile(jobDescFile);
    Config updatedConfig = JobUtils.overrideConfigs(job, cfg);
    updatedConfig = Config.newBuilder().putAll(updatedConfig).put(MPIContext.TWISTER2_HOME.getKey(), twister2Home).put(MPIContext.WORKER_CLASS, job.getWorkerClassName()).put(MPIContext.TWISTER2_CONTAINER_ID, globalRank).put(MPIContext.JOB_ID, jobId).put(MPIContext.JOB_OBJECT, job).put(MPIContext.TWISTER2_CLUSTER_TYPE, clusterType).put(JobMasterContext.JOB_MASTER_IP, jIp).put(JobMasterContext.JOB_MASTER_PORT, jPort).put(ZKContext.SERVER_ADDRESSES, null).put(CheckpointingContext.CHECKPOINTING_RESTORE_JOB, restoreJob).build();
    LOG.log(Level.FINE, String.format("Initializing process with " + "twister_home: %s worker_class: %s config_dir: %s cluster_type: %s", twister2Home, job.getWorkerClassName(), configDir, clusterType));
    return updatedConfig;
}
Also used : Config(edu.iu.dsc.tws.api.config.Config)

Example 88 with Config

use of edu.iu.dsc.tws.api.config.Config in project twister2 by DSC-SPIDAL.

the class NomadJobMasterStarter method loadConfigurations.

private Config loadConfigurations(CommandLine cmd, int id) {
    String twister2Home = cmd.getOptionValue("twister2_home");
    String container = cmd.getOptionValue("container_class");
    String configDir = cmd.getOptionValue("config_dir");
    String clusterType = cmd.getOptionValue("cluster_type");
    String jobId = cmd.getOptionValue("job_id");
    LOG.log(Level.FINE, String.format("Initializing process with " + "twister_home: %s container_class: %s config_dir: %s cluster_type: %s", twister2Home, container, configDir, clusterType));
    Config cfg = ConfigLoader.loadConfig(twister2Home, configDir, clusterType);
    Config workerConfig = Config.newBuilder().putAll(cfg).put(SchedulerContext.TWISTER2_HOME.getKey(), twister2Home).put(SchedulerContext.WORKER_CLASS, container).put(SchedulerContext.TWISTER2_CONTAINER_ID, id).put(SchedulerContext.JOB_ID, jobId).put(SchedulerContext.TWISTER2_CLUSTER_TYPE, clusterType).build();
    String jobDescFile = JobUtils.getJobDescriptionFilePath(jobId, workerConfig);
    job = JobUtils.readJobFile(jobDescFile);
    job.getNumberOfWorkers();
    Config updatedConfig = JobUtils.overrideConfigs(job, cfg);
    updatedConfig = Config.newBuilder().putAll(updatedConfig).put(SchedulerContext.TWISTER2_HOME.getKey(), twister2Home).put(SchedulerContext.WORKER_CLASS, container).put(SchedulerContext.TWISTER2_CONTAINER_ID, id).put(SchedulerContext.TWISTER2_CLUSTER_TYPE, clusterType).put(SchedulerContext.JOB_ID, jobId).put(SchedulerContext.JOB_NAME, job.getJobName()).build();
    return updatedConfig;
}
Also used : Config(edu.iu.dsc.tws.api.config.Config)

Example 89 with Config

use of edu.iu.dsc.tws.api.config.Config in project twister2 by DSC-SPIDAL.

the class LFSTest method main.

public static void main(String[] args) throws IOException {
    Config config = Config.newBuilder().put(FsContext.UPLOAD_DIRECTORY, "/home/user/Desktop/test1/").build();
    LocalFileSystemUploader lsf = new LocalFileSystemUploader();
    lsf.initialize(config, null);
    URI returned = lsf.uploadPackage("/home/user/Desktop/tobecopied/");
    System.out.printf(returned.toString());
}
Also used : Config(edu.iu.dsc.tws.api.config.Config) URI(java.net.URI)

Example 90 with Config

use of edu.iu.dsc.tws.api.config.Config in project beam by apache.

the class BeamBatchWorker method execute.

@Override
public void execute(BatchTSetEnvironment env) {
    Config config = env.getConfig();
    Map<String, String> sideInputIds = (LinkedHashMap<String, String>) config.get(SIDEINPUTS);
    Set<String> leaveIds = (Set<String>) config.get(LEAVES);
    TBaseGraph graph = (TBaseGraph) config.get(GRAPH);
    env.settBaseGraph(graph);
    setupTSets(env, sideInputIds, leaveIds);
    resetEnv(env, graph);
    executePipeline(env);
}
Also used : ComputeTSet(edu.iu.dsc.tws.tset.sets.batch.ComputeTSet) BuildableTSet(edu.iu.dsc.tws.tset.sets.BuildableTSet) CachedTSet(edu.iu.dsc.tws.tset.sets.batch.CachedTSet) SinkTSet(edu.iu.dsc.tws.tset.sets.batch.SinkTSet) Set(java.util.Set) BaseTSet(edu.iu.dsc.tws.tset.sets.BaseTSet) TSet(edu.iu.dsc.tws.api.tset.sets.TSet) BatchTSet(edu.iu.dsc.tws.api.tset.sets.batch.BatchTSet) HashSet(java.util.HashSet) Config(edu.iu.dsc.tws.api.config.Config) TBaseGraph(edu.iu.dsc.tws.tset.TBaseGraph) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

Config (edu.iu.dsc.tws.api.config.Config)169 JobConfig (edu.iu.dsc.tws.api.JobConfig)101 Twister2Job (edu.iu.dsc.tws.api.Twister2Job)52 CommandLine (org.apache.commons.cli.CommandLine)27 CommandLineParser (org.apache.commons.cli.CommandLineParser)27 DefaultParser (org.apache.commons.cli.DefaultParser)27 Options (org.apache.commons.cli.Options)27 HashMap (java.util.HashMap)26 ComputeGraph (edu.iu.dsc.tws.api.compute.graph.ComputeGraph)18 Map (java.util.Map)15 TaskSchedulePlan (edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan)13 WorkerPlan (edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan)12 LinkedHashMap (java.util.LinkedHashMap)12 Test (org.junit.Test)12 Path (edu.iu.dsc.tws.api.data.Path)10 TaskInstancePlan (edu.iu.dsc.tws.api.compute.schedule.elements.TaskInstancePlan)9 WorkerSchedulePlan (edu.iu.dsc.tws.api.compute.schedule.elements.WorkerSchedulePlan)9 JobAPI (edu.iu.dsc.tws.proto.system.job.JobAPI)9 TaskSchedulerClassTest (edu.iu.dsc.tws.tsched.utils.TaskSchedulerClassTest)9 ExecutionPlan (edu.iu.dsc.tws.api.compute.executor.ExecutionPlan)8