Java Code Examples for com.hazelcast.jet.config.JobConfig#setName()

The following examples show how to use com.hazelcast.jet.config.JobConfig#setName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Task1JetJob.java    From hazelcast-jet-demos with Apache License 2.0 6 votes vote down vote up
/**
 * <p>Run one copy of the Moving Average job
 * in this cluster.
 * </p>
 */
@Override
public void run(String... args) throws Exception {
	String prefix = this.getClass().getSimpleName() + " -";
	
	Pipeline pipeline = MovingAverage.build();
   		JobConfig jobConfig = new JobConfig();
   		jobConfig.setName(MyConstants.JOB_NAME);

   		// Run job if not already present
	Job job = this.jetInstance.getJob(jobConfig.getName());
   		if (job == null) {
       	    job = this.jetInstance.newJobIfAbsent(pipeline, jobConfig);
   		}

   		log.info("{} Job '{}', status '{}'.",
           		prefix, job.getName(), job.getStatus());
}
 
Example 2
Source File: JetRunner.java    From beam with Apache License 2.0 6 votes vote down vote up
private JobConfig getJobConfig(JetPipelineOptions options) {
  JobConfig jobConfig = new JobConfig();

  String jobName = options.getJobName();
  if (jobName != null) {
    jobConfig.setName(jobName);
  }

  boolean hasNoLocalMembers = options.getJetLocalMode() <= 0;
  if (hasNoLocalMembers) {
    String codeJarPathname = options.getCodeJarPathname();
    if (codeJarPathname != null && !codeJarPathname.isEmpty()) {
      jobConfig.addJar(codeJarPathname);
    }
  }

  return jobConfig;
}
 
Example 3
Source File: BreastCancerClassification.java    From hazelcast-jet-demos with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    if (args.length != 2) {
        System.err.println("Missing command-line arguments: <model-file-path> <validation-input-data>");
        System.exit(1);
    }

    Path modelFile = Paths.get(args[0]).toAbsolutePath();
    Path inputFile = Paths.get(args[1]).toAbsolutePath();
    validateFileReadable(modelFile);
    validateFileReadable(inputFile);

    System.setProperty("hazelcast.logging.type", "log4j");

    JetInstance jet = Jet.newJetInstance();

    JobConfig jobConfig = new JobConfig();
    jobConfig.setName("h2o Breast Cancer Classification");
    jobConfig.attachFile(modelFile.toString(), "model");

    Job job = jet.newJob(buildPipeline(inputFile), jobConfig);

    try {
        job.join();
    } finally {
        jet.shutdown();
    }
}
 
Example 4
Source File: ApplicationRunner.java    From hazelcast-jet-demos with Apache License 2.0 5 votes vote down vote up
@Override
public void run(String... args) throws Exception {
	Pipeline pipeline = FileWatcher.build();
	
	JobConfig jobConfig = new JobConfig();
	jobConfig.setName(FileWatcher.class.getSimpleName());

	this.jetInstance.newJobIfAbsent(pipeline, jobConfig);
}