-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
13 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 10 additions & 15 deletions
25
elastic-job-doc/elastic-job-cloud-doc/content/02-guide/local-executor.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,37 @@ | ||
+++ | ||
toc = true | ||
date = "2017-06-05T16:14:21+08:00" | ||
title = "本地运行作业" | ||
title = "本地运行模式" | ||
weight = 40 | ||
prev = "/02-guide/event-trace/" | ||
next = "/03-design" | ||
+++ | ||
|
||
在开发`Elastic-Job-Cloud`作业的时候,开发人员会希望能够本地运行作业。目前作业云提供了该功能,您只需要使用简单的API配置作业,就可以像在 | ||
`Mesos`集群中一样本地运行作业。 | ||
在开发`Elastic-Job-Cloud`作业时,开发人员可以脱离`Mesos`环境,在本地运行和调试作业。可以利用本地运行模式充分的调试业务功能以及单元测试,完成之后再部署至`Mesos`集群。 | ||
|
||
本地运行作业无需安装`Mesos`环境。 | ||
|
||
## 本地作业配置 | ||
## 配置 | ||
|
||
使用`com.dangdang.ddframe.job.cloud.executor.local.LocalCloudJobConfiguration`来配置本地作业。 | ||
使用`com.dangdang.ddframe.job.cloud.executor.local.LocalCloudJobConfiguration`配置本地作业。 | ||
|
||
```java | ||
LocalCloudJobConfiguration config = new LocalCloudJobConfiguration( | ||
new SimpleJobConfiguration(JobCoreConfiguration.newBuilder("FooJob", "*/2 * * * * ?", 3) //1 | ||
.shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou") | ||
.jobParameter("dbName=dangdang").build() | ||
, "com.dangdang.foo.FooJob") | ||
, LocalCloudJobExecutionType.DAEMON //2 | ||
, 1 //3 | ||
, "testSimpleJob" //4 | ||
, "applicationContext.xml") | ||
.jobParameter("dbName=dangdang").build(), "com.dangdang.foo.FooJob"), | ||
1, //2 | ||
"testSimpleJob" , "applicationContext.xml"); //3 | ||
``` | ||
|
||
1. 配置作业类型和作业基本信息。 | ||
1. 配置作业的执行类型。 | ||
1. 配置当前运行的作业是第几个分片。 | ||
1. 配置Spring相关参数。 | ||
|
||
## 运行本地作业 | ||
## 运行 | ||
|
||
使用`com.dangdang.ddframe.job.cloud.executor.local.LocalTaskExecutor`运行作业。 | ||
|
||
```java | ||
new LocalTaskExecutor(config).execute(); | ||
``` | ||
new LocalTaskExecutor(localJobConfig).execute(); | ||
``` |