From 2f03474bbeefed5860353f95c1180080d3191804 Mon Sep 17 00:00:00 2001 From: Michael Minella Date: Thu, 8 Sep 2016 12:29:49 -0500 Subject: [PATCH] Added details discovered when testing against CloudFoundry --- .../src/main/asciidoc/batch.adoc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/spring-cloud-task-docs/src/main/asciidoc/batch.adoc b/spring-cloud-task-docs/src/main/asciidoc/batch.adoc index 1edae8e8..75409df4 100644 --- a/spring-cloud-task-docs/src/main/asciidoc/batch.adoc +++ b/spring-cloud-task-docs/src/main/asciidoc/batch.adoc @@ -61,6 +61,7 @@ at once, the interval to poll for the results (defaults to 10 seconds), and a ti look like the following: ``` + @Bean public PartitionHandler partitionHandler(TaskLauncher taskLauncher, JobExplorer jobExplorer) throws Exception { @@ -69,22 +70,24 @@ public PartitionHandler partitionHandler(TaskLauncher taskLauncher, mavenProperties.setRemoteRepositories(new HashMap<>(Collections.singletonMap("springRepo", new MavenProperties.RemoteRepository(repository)))); - MavenResource resource = + Resource resource = MavenResource.parse(String.format("%s:%s:%s", "io.spring.cloud", "partitioned-batch-job", - "1.0.0.RELEASE"), mavenProperties); + "1.1.0.BUILD-SNAPSHOT"), mavenProperties); DeployerPartitionHandler partitionHandler = new DeployerPartitionHandler(taskLauncher, jobExplorer, resource, "workerStep"); - Map environmentProperties = new HashMap<>(); - environmentProperties.put("spring.profiles.active", "worker"); - SimpleEnvironmentVariablesProvider environmentVariablesProvider = new SimpleEnvironmentVariablesProvider(this.environment); - environmentVariablesProvider.setEnvironmentProperties(environmentProperties); - partitionHandler.setEnvironmentVariablesProvider(environmentVariablesProvider); + List commandLineArgs = new ArrayList<>(3); + commandLineArgs.add("--spring.profiles.active=worker"); + commandLineArgs.add("--spring.cloud.task.initialize.enable=false"); + commandLineArgs.add("--spring.batch.initializer.enabled=false"); + partitionHandler.setCommandLineArgsProvider(new PassThroughCommandLineArgsProvider(commandLineArgs)); + partitionHandler.setEnvironmentVariablesProvider(new NoOpEnvironmentVariablesProvider()); partitionHandler.setMaxWorkers(2); + partitionHandler.setApplicationName("PartitionedBatchJobTask"); return partitionHandler; } @@ -112,7 +115,7 @@ public DeployerStepExecutionHandler stepExecutionHandler(JobExplorer jobExplorer === Notes on developing a batch partitioned app for the Yarn platform * When deploying partitioned apps on the Yarn platform be sure use the following dependency for the -Spring Cloud Yarn Deployer: +Spring Cloud Yarn Deployer (with a version 1.0.2 or higher): ``` org.springframework.cloud