Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DolphinScheduler社区
DolphinScheduler
提交
fd26ed82
DolphinScheduler
项目概览
DolphinScheduler社区
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
67
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
fd26ed82
编写于
5月 09, 2019
作者:
B
Baoqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
close #106 support to store resources in s3a(support aws s3 & minio)
上级
4e51d0d9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
57 addition
and
2 deletion
+57
-2
escheduler-common/pom.xml
escheduler-common/pom.xml
+23
-0
escheduler-common/src/main/java/cn/escheduler/common/utils/HadoopUtils.java
...src/main/java/cn/escheduler/common/utils/HadoopUtils.java
+12
-2
escheduler-common/src/main/java/cn/escheduler/common/utils/PropertyUtils.java
...c/main/java/cn/escheduler/common/utils/PropertyUtils.java
+17
-0
pom.xml
pom.xml
+5
-0
未找到文件。
escheduler-common/pom.xml
浏览文件 @
fd26ed82
...
...
@@ -230,6 +230,29 @@
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.hadoop
</groupId>
<artifactId>
hadoop-aws
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.apache.hadoop
</groupId>
<artifactId>
hadoop-common
</artifactId>
</exclusion>
<exclusion>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-core
</artifactId>
</exclusion>
<exclusion>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
</exclusion>
<exclusion>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-annotations
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
...
...
escheduler-common/src/main/java/cn/escheduler/common/utils/HadoopUtils.java
浏览文件 @
fd26ed82
...
...
@@ -34,12 +34,14 @@ import org.slf4j.LoggerFactory;
import
java.io.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
static
cn
.
escheduler
.
common
.
Constants
.*;
import
static
cn
.
escheduler
.
common
.
utils
.
PropertyUtils
.
getInt
;
import
static
cn
.
escheduler
.
common
.
utils
.
PropertyUtils
.
getString
;
import
static
cn
.
escheduler
.
common
.
utils
.
PropertyUtils
.
getPrefixedProperties
;
/**
* hadoop utils
...
...
@@ -76,7 +78,9 @@ public class HadoopUtils implements Closeable {
if
(
defaultFS
.
startsWith
(
"file"
)){
String
defaultFSProp
=
getString
(
FS_DEFAULTFS
);
if
(
StringUtils
.
isNotBlank
(
defaultFSProp
)){
Map
<
String
,
String
>
fsRelatedProps
=
getPrefixedProperties
(
"fs."
);
configuration
.
set
(
FS_DEFAULTFS
,
defaultFSProp
);
fsRelatedProps
.
entrySet
().
stream
().
forEach
(
entry
->
configuration
.
set
(
entry
.
getKey
(),
entry
.
getValue
()));
}
else
{
logger
.
error
(
"property:{} can not to be empty, please set!"
);
throw
new
RuntimeException
(
"property:{} can not to be empty, please set!"
);
...
...
@@ -316,7 +320,13 @@ public class HadoopUtils implements Closeable {
* @return data hdfs path
*/
public
static
String
getHdfsDataBasePath
()
{
return
getString
(
DATA_STORE_2_HDFS_BASEPATH
);
String
basePath
=
getString
(
DATA_STORE_2_HDFS_BASEPATH
);
if
(
"/"
.
equals
(
basePath
))
{
// if basepath is configured to /, the generated url may be //default/resources (with extra leading /)
return
""
;
}
else
{
return
basePath
;
}
}
/**
...
...
@@ -365,7 +375,7 @@ public class HadoopUtils implements Closeable {
* @return file directory of tenants on hdfs
*/
private
static
String
getHdfsTenantDir
(
String
tenantCode
)
{
return
String
.
format
(
"%s/%s"
,
get
String
(
DATA_STORE_2_HDFS_BASEPATH
),
tenantCode
);
return
String
.
format
(
"%s/%s"
,
get
HdfsDataBasePath
(
),
tenantCode
);
}
...
...
escheduler-common/src/main/java/cn/escheduler/common/utils/PropertyUtils.java
浏览文件 @
fd26ed82
...
...
@@ -22,6 +22,8 @@ import org.slf4j.LoggerFactory;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Properties
;
import
static
cn
.
escheduler
.
common
.
Constants
.
COMMON_PROPERTIES_PATH
;
...
...
@@ -189,4 +191,19 @@ public class PropertyUtils {
String
val
=
getString
(
key
);
return
val
==
null
?
defaultValue
:
Enum
.
valueOf
(
type
,
val
);
}
/**
* get all properties with specified prefix, like: fs.
* @param prefix prefix to search
* @return
*/
public
static
Map
<
String
,
String
>
getPrefixedProperties
(
String
prefix
)
{
Map
<
String
,
String
>
matchedProperties
=
new
HashMap
<>();
for
(
String
propName
:
properties
.
stringPropertyNames
())
{
if
(
propName
.
startsWith
(
prefix
))
{
matchedProperties
.
put
(
propName
,
properties
.
getProperty
(
propName
));
}
}
return
matchedProperties
;
}
}
pom.xml
浏览文件 @
fd26ed82
...
...
@@ -323,6 +323,11 @@
<artifactId>
hadoop-yarn-common
</artifactId>
<version>
${hadoop.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.hadoop
</groupId>
<artifactId>
hadoop-aws
</artifactId>
<version>
${hadoop.version}
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录