Skip to content

Commit

Permalink
Merge pull request #39 from frankfreedom/feature-rundate
Browse files Browse the repository at this point in the history
系统静态变量--properties支持${run_date}
  • Loading branch information
SelfImpr001 authored Aug 30, 2020
2 parents 0e220a1 + 22d0d6e commit b0d2011
Show file tree
Hide file tree
Showing 6 changed files with 412 additions and 320 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ private void convertYamlFiles(final File projectDir) {
}
}
} catch (final Exception e) {
this.errors.add("Error loading flow yaml file " + file.getName() + ":"
logger.error("Error loading flow yaml file {}, cause by:", file.getName(), e);
this.errors.add("Error loading flow yaml file " + file.getName() + ", cause by:"
+ e.getMessage());
}
}
Expand Down Expand Up @@ -224,7 +225,7 @@ private void addEdges(final AzkabanNode node, final AzkabanFlow azkabanFlow,
if (recStack.contains(parent)) {
// Cycles found, including self cycle.
edge.setError("Cycles found.");
this.errors.add("Cycles found at " + edge.getId());
this.errors.add("Cycles found at " + edge.getId() + ", please check the dependency information.");
} else {
// Valid edge. Continue to process the parent node recursively.
addEdges(azkabanFlow.getNode(parent), azkabanFlow, flowName, recStack, visited);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.webank.wedatasphere.schedulis.common.jobExecutor.utils;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

public enum Date {

RUN_TODAY("run_today", "day", "yyyyMMdd"),
RUN_TODAY_STD("run_today_std", "day", "yyyy-MM-dd"),
RUN_DATE("run_date", "day", "yyyyMMdd"),
RUN_DATE_STD("run_date_std", "day", "yyyy-MM-dd"),
RUN_MONTH_BEGIN("run_month_begin", "month", "yyyyMMdd"),
RUN_MONTH_BEGIN_STD("run_month_begin_std", "month", "yyyy-MM-dd"),
RUN_MONTH_END("run_month_end", "month", "yyyyMMdd"),
RUN_MONTH_END_STD("run_month_end_std", "month", "yyyy-MM-dd"),

RUN_QUARTER_BEGIN("run_quarter_begin", "quarter", "yyyyMMdd"),
RUN_QUARTER_END("run_quarter_end", "quarter", "yyyyMMdd"),
RUN_HALF_YEAR_BEGIN("run_half_year_begin", "halfYear", "yyyyMMdd"),
RUN_HALF_YEAR_END("run_half_year_end", "halfYear", "yyyyMMdd"),
RUN_YEAR_BEGIN("run_year_begin", "year", "yyyyMMdd"),
RUN_YEAR_END("run_year_end", "year", "yyyyMMdd"),
RUN_LAST_MONTH_END("run_last_month_end", "month", "yyyyMMdd"),
RUN_LAST_QUARTER_END("run_last_quarter_end", "quarter", "yyyyMMdd"),
RUN_LAST_YEAR_END("run_last_year_end", "year", "yyyyMMdd"),

RUN_QUARTER_BEGIN_STD("run_quarter_begin_std", "quarter", "yyyy-MM-dd"),
RUN_QUARTER_END_STD("run_quarter_end_std", "quarter", "yyyy-MM-dd"),
RUN_HALF_YEAR_BEGIN_STD("run_half_year_begin_std", "halfYear", "yyyy-MM-dd"),
RUN_HALF_YEAR_END_STD("run_half_year_end_std", "halfYear", "yyyy-MM-dd"),
RUN_YEAR_BEGIN_STD("run_year_begin_std", "year", "yyyy-MM-dd"),
RUN_YEAR_END_STD("run_year_end_std", "year", "yyyy-MM-dd"),
RUN_LAST_MONTH_END_STD("run_last_month_end_std", "month", "yyyy-MM-dd"),
RUN_LAST_QUARTER_END_STD("run_last_quarter_end_std", "quarter", "yyyy-MM-dd"),
RUN_LAST_YEAR_END_STD("run_last_year_end_std", "year", "yyyy-MM-dd");

private String value;
private String calRule;
private String format;

private static Map<String, Date> DATE_MAP = Arrays.stream(Date.values()).collect(Collectors.toMap(x -> x.getValue(), x -> x));


Date(String value, String calRule, String format) {
this.value = value;
this.calRule = calRule;
this.format = format;
}


public String getValue() {
return value;
}

public String getCalRule() {
return calRule;
}

public String getFormat() {
return format;
}

public static Map<String, Date> getDateMap() {
return DATE_MAP;
}

@Override
public String toString() {
return this.value;
}
}
Loading

0 comments on commit b0d2011

Please sign in to comment.