status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | else {
f0 = new FileInputStream(redirects[0].file());
stdHandles[0] = fdAccess.getHandle(f0.getFD());
}
if (redirects[1] == ProcessBuilderForWin32.Redirect.PIPE)
stdHandles[1] = -1L;
else if (redirects[1] == ProcessBuilderForWin32.Redirect.INHERIT)
stdHandles[1] = fdAccess.getHandle(FileDescriptor.out);
else {
f1 = newFileOutputStream(redirects[1].file(),
redirects[1].append());
stdHandles[1] = fdAccess.getHandle(f1.getFD());
}
if (redirects[2] == ProcessBuilderForWin32.Redirect.PIPE)
stdHandles[2] = -1L;
else if (redirects[2] == ProcessBuilderForWin32.Redirect.INHERIT)
stdHandles[2] = fdAccess.getHandle(FileDescriptor.err);
else {
f2 = newFileOutputStream(redirects[2].file(),
redirects[2].append());
stdHandles[2] = fdAccess.getHandle(f2.getFD());
}
}
return new ProcessImplForWin32(username, password, cmdarray, envblock, dir, stdHandles, redirectErrorStream);
} finally {
try { if (f0 != null) f0.close(); }
finally {
try { if (f1 != null) f1.close(); } |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | finally { if (f2 != null) f2.close(); }
}
}
}
private static class LazyPattern {
private static final Pattern PATTERN =
Pattern.compile("[^\\s\"]+|\"[^\"]*\"");
};
/* Parses the command string parameter into the executable name and
* program arguments.
*
* The command string is broken into tokens. The token separator is a space
* or quota character. The space inside quotation is not a token separator.
* There are no escape sequences.
*/
private static String[] getTokensFromCommand(String command) {
ArrayList<String> matchList = new ArrayList<>(8);
Matcher regexMatcher = ProcessImplForWin32.LazyPattern.PATTERN.matcher(command);
while (regexMatcher.find())
matchList.add(regexMatcher.group());
return matchList.toArray(new String[matchList.size()]);
}
private static final int VERIFICATION_CMD_BAT = 0;
private static final int VERIFICATION_WIN32 = 1;
private static final int VERIFICATION_WIN32_SAFE = 2;
private static final int VERIFICATION_LEGACY = 3; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | private static final char ESCAPE_VERIFICATION[][] = {
{' ', '\t', '<', '>', '&', '|', '^'},
{' ', '\t', '<', '>'},
{' ', '\t', '<', '>'},
{' ', '\t'}
};
private static String createCommandLine(int verificationType,
final String executablePath,
final String cmd[])
{
StringBuilder cmdbuf = new StringBuilder(80);
cmdbuf.append(executablePath);
for (int i = 1; i < cmd.length; ++i) {
cmdbuf.append(' ');
String s = cmd[i];
if (needsEscaping(verificationType, s)) {
cmdbuf.append('"');
if (verificationType == VERIFICATION_WIN32_SAFE) {
int length = s.length();
for (int j = 0; j < length; j++) {
char c = s.charAt(j);
if (c == DOUBLEQUOTE) {
int count = countLeadingBackslash(verificationType, s, j);
while (count-- > 0) {
cmdbuf.append(BACKSLASH);
}
cmdbuf.append(BACKSLASH); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | }
cmdbuf.append(c);
}
} else {
cmdbuf.append(s);
}
int count = countLeadingBackslash(verificationType, s, s.length());
while (count-- > 0) {
cmdbuf.append(BACKSLASH);
}
cmdbuf.append('"');
} else {
cmdbuf.append(s);
}
}
return cmdbuf.toString();
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | * Return the argument without quotes (1st and last) if present, else the arg.
* @param str a string
* @return the string without 1st and last quotes
*/
private static String unQuote(String str) {
int len = str.length();
return (len >= 2 && str.charAt(0) == DOUBLEQUOTE && str.charAt(len - 1) == DOUBLEQUOTE)
? str.substring(1, len - 1)
: str;
}
private static boolean needsEscaping(int verificationType, String arg) {
String unquotedArg = unQuote(arg);
boolean argIsQuoted = !arg.equals(unquotedArg);
boolean embeddedQuote = unquotedArg.indexOf(DOUBLEQUOTE) >= 0;
switch (verificationType) {
case VERIFICATION_CMD_BAT:
if (embeddedQuote) {
throw new IllegalArgumentException("Argument has embedded quote, " +
"use the explicit CMD.EXE call.");
}
break;
case VERIFICATION_WIN32_SAFE:
if (argIsQuoted && embeddedQuote) {
throw new IllegalArgumentException("Malformed argument has embedded quote: " |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | + unquotedArg);
}
break;
default:
break;
}
if (!argIsQuoted) {
char testEscape[] = ESCAPE_VERIFICATION[verificationType];
for (int i = 0; i < testEscape.length; ++i) {
if (arg.indexOf(testEscape[i]) >= 0) {
return true;
}
}
}
return false;
}
private static String getExecutablePath(String path)
throws IOException
{
String name = unQuote(path);
if (name.indexOf(DOUBLEQUOTE) >= 0) {
throw new IllegalArgumentException("Executable name has embedded quote, " +
"split the arguments: " + name);
}
File fileToRun = new File(name); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | return fileToRun.getPath();
}
/**
* An executable is any program that is an EXE or does not have an extension
* and the Windows createProcess will be looking for .exe.
* The comparison is case insensitive based on the name.
* @param executablePath the executable file
* @return true if the path ends in .exe or does not have an extension.
*/
private boolean isExe(String executablePath) {
File file = new File(executablePath);
String upName = file.getName().toUpperCase(Locale.ROOT);
return (upName.endsWith(".EXE") || upName.indexOf('.') < 0);
}
private boolean isShellFile(String executablePath) {
String upPath = executablePath.toUpperCase();
return (upPath.endsWith(".CMD") || upPath.endsWith(".BAT"));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | private String quoteString(String arg) {
StringBuilder argbuf = new StringBuilder(arg.length() + 2);
return argbuf.append('"').append(arg).append('"').toString();
}
private static int countLeadingBackslash(int verificationType,
CharSequence input, int start) {
if (verificationType == VERIFICATION_CMD_BAT)
return 0;
int j;
for (j = start - 1; j >= 0 && input.charAt(j) == BACKSLASH; j--) {
}
return (start - 1) - j;
}
private static final char DOUBLEQUOTE = '\"';
private static final char BACKSLASH = '\\';
private WinNT.HANDLE handle;
private OutputStream stdin_stream;
private InputStream stdout_stream;
private InputStream stderr_stream;
private ProcessImplForWin32(
String username,
String password,
String cmd[],
final String envblock,
final String path,
final long[] stdHandles,
final boolean redirectErrorStream) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | throws IOException
{
String cmdstr;
final SecurityManager security = System.getSecurityManager();
GetPropertyAction action = new GetPropertyAction("jdk.lang.Process.allowAmbiguousCommands",
(security == null) ? "true" : "false");
final boolean allowAmbiguousCommands = !"false".equalsIgnoreCase(action.run());
if (allowAmbiguousCommands && security == null) {
String executablePath = new File(cmd[0]).getPath();
if (needsEscaping(VERIFICATION_LEGACY, executablePath) )
executablePath = quoteString(executablePath);
cmdstr = createCommandLine(
VERIFICATION_LEGACY,
executablePath,
cmd);
} else {
String executablePath;
try {
executablePath = getExecutablePath(cmd[0]);
} catch (IllegalArgumentException e) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | StringBuilder join = new StringBuilder();
for (String s : cmd)
join.append(s).append(' ');
cmd = getTokensFromCommand(join.toString());
executablePath = getExecutablePath(cmd[0]);
if (security != null)
security.checkExec(executablePath);
}
boolean isShell = allowAmbiguousCommands ? isShellFile(executablePath)
: !isExe(executablePath);
cmdstr = createCommandLine(
isShell ? VERIFICATION_CMD_BAT
: (allowAmbiguousCommands ? VERIFICATION_WIN32 : VERIFICATION_WIN32_SAFE),
quoteString(executablePath),
cmd);
}
handle = create(username, password, cmdstr, envblock, path, stdHandles, redirectErrorStream);
AccessController.doPrivileged(
new PrivilegedAction<Void>() {
public Void run() {
if (stdHandles[0] == -1L) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | stdin_stream = ProcessBuilderForWin32.NullOutputStream.INSTANCE;
else {
FileDescriptor stdin_fd = new FileDescriptor();
fdAccess.setHandle(stdin_fd, stdHandles[0]);
stdin_stream = new BufferedOutputStream(
new FileOutputStream(stdin_fd));
}
if (stdHandles[1] == -1L)
stdout_stream = ProcessBuilderForWin32.NullInputStream.INSTANCE;
else {
FileDescriptor stdout_fd = new FileDescriptor();
fdAccess.setHandle(stdout_fd, stdHandles[1]);
stdout_stream = new BufferedInputStream(
new FileInputStream(stdout_fd));
}
if (stdHandles[2] == -1L)
stderr_stream = ProcessBuilderForWin32.NullInputStream.INSTANCE;
else {
FileDescriptor stderr_fd = new FileDescriptor();
fdAccess.setHandle(stderr_fd, stdHandles[2]);
stderr_stream = new FileInputStream(stderr_fd);
}
return null; }});
}
public OutputStream getOutputStream() {
return stdin_stream;
}
public InputStream getInputStream() {
return stdout_stream;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | public InputStream getErrorStream() {
return stderr_stream;
}
protected void finalize() {
closeHandle(handle);
}
public int exitValue() {
int exitCode = getExitCodeProcess(handle);
if (exitCode == STILL_ACTIVE)
throw new IllegalThreadStateException("process has not exited");
return exitCode;
}
public int waitFor() throws InterruptedException {
waitForInterruptibly(handle);
if (Thread.interrupted())
throw new InterruptedException();
return exitValue();
}
@Override
public boolean waitFor(long timeout, TimeUnit unit)
throws InterruptedException
{
if (getExitCodeProcess(handle) != STILL_ACTIVE) return true;
if (timeout <= 0) return false;
long remainingNanos = unit.toNanos(timeout);
long deadline = System.nanoTime() + remainingNanos ;
do {
long msTimeout = TimeUnit.NANOSECONDS.toMillis(remainingNanos + 999_999L);
waitForTimeoutInterruptibly(handle, msTimeout); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | if (Thread.interrupted())
throw new InterruptedException();
if (getExitCodeProcess(handle) != STILL_ACTIVE) {
return true;
}
remainingNanos = deadline - System.nanoTime();
} while (remainingNanos > 0);
return (getExitCodeProcess(handle) != STILL_ACTIVE);
}
public void destroy() { terminateProcess(handle); }
public Process destroyForcibly() {
destroy();
return this;
}
public boolean isAlive() {
return isProcessAlive(handle);
}
private static boolean initHolder(WinNT.HANDLEByReference pjhandles,
WinNT.HANDLEByReference[] pipe,
int offset,
WinNT.HANDLEByReference phStd) {
if (!pjhandles.getValue().equals(JAVA_INVALID_HANDLE_VALUE)) {
phStd.setValue(pjhandles.getValue());
pjhandles.setValue(JAVA_INVALID_HANDLE_VALUE);
} else {
if (!Kernel32.INSTANCE.CreatePipe(pipe[0], pipe[1], null, PIPE_SIZE)) {
throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
} else {
WinNT.HANDLE thisProcessEnd = offset == OFFSET_READ ? pipe[1].getValue() : pipe[0].getValue();
phStd.setValue(pipe[offset].getValue()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | pjhandles.setValue(thisProcessEnd);
}
}
Kernel32.INSTANCE.SetHandleInformation(phStd.getValue(), Kernel32.HANDLE_FLAG_INHERIT, Kernel32.HANDLE_FLAG_INHERIT);
return true;
}
private static void releaseHolder(boolean complete, WinNT.HANDLEByReference[] pipe, int offset) {
closeHandle(pipe[offset].getValue());
if (complete) {
closeHandle(pipe[offset == OFFSET_READ ? OFFSET_WRITE : OFFSET_READ].getValue());
}
}
private static void prepareIOEHandleState(WinNT.HANDLE[] stdIOE, Boolean[] inherit) {
for(int i = 0; i < HANDLE_STORAGE_SIZE; ++i) {
WinNT.HANDLE hstd = stdIOE[i];
if (!Kernel32.INVALID_HANDLE_VALUE.equals(hstd)) {
inherit[i] = Boolean.TRUE;
Kernel32.INSTANCE.SetHandleInformation(hstd, Kernel32.HANDLE_FLAG_INHERIT, 0);
}
}
}
private static void restoreIOEHandleState(WinNT.HANDLE[] stdIOE, Boolean[] inherit) {
for (int i = HANDLE_STORAGE_SIZE - 1; i >= 0; --i) {
if (!Kernel32.INVALID_HANDLE_VALUE.equals(stdIOE[i])) {
Kernel32.INSTANCE.SetHandleInformation(stdIOE[i], Kernel32.HANDLE_FLAG_INHERIT, inherit[i] ? Kernel32.HANDLE_FLAG_INHERIT : 0);
}
}
}
private static WinNT.HANDLE processCreate(String username,
String password, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | String cmd,
final String envblock,
final String path,
final WinNT.HANDLEByReference[] stdHandles,
final boolean redirectErrorStream) {
WinNT.HANDLE ret = new WinNT.HANDLE(Pointer.createConstant(0));
WinNT.HANDLE[] stdIOE = new WinNT.HANDLE[] {
Kernel32.INVALID_HANDLE_VALUE, Kernel32.INVALID_HANDLE_VALUE, Kernel32.INVALID_HANDLE_VALUE,
stdHandles[0].getValue(), stdHandles[1].getValue(), stdHandles[2].getValue()
};
stdIOE[0] = Kernel32.INSTANCE.GetStdHandle(Kernel32.STD_INPUT_HANDLE);
stdIOE[1] = Kernel32.INSTANCE.GetStdHandle(Kernel32.STD_OUTPUT_HANDLE);
stdIOE[2] = Kernel32.INSTANCE.GetStdHandle(Kernel32.STD_ERROR_HANDLE);
Boolean[] inherit = new Boolean[] {
Boolean.FALSE, Boolean.FALSE, Boolean.FALSE,
Boolean.FALSE, Boolean.FALSE, Boolean.FALSE
};
prepareIOEHandleState(stdIOE, inherit);
WinNT.HANDLEByReference hStdInput = new WinNT.HANDLEByReference();
WinNT.HANDLEByReference[] pipeIn = new WinNT.HANDLEByReference[] {
new WinNT.HANDLEByReference(Kernel32.INVALID_HANDLE_VALUE), new WinNT.HANDLEByReference(Kernel32.INVALID_HANDLE_VALUE) };
WinNT.HANDLEByReference hStdOutput = new WinNT.HANDLEByReference();
WinNT.HANDLEByReference[] pipeOut = new WinNT.HANDLEByReference[] {
new WinNT.HANDLEByReference(Kernel32.INVALID_HANDLE_VALUE), new WinNT.HANDLEByReference(Kernel32.INVALID_HANDLE_VALUE) };
WinNT.HANDLEByReference hStdError = new WinNT.HANDLEByReference();
WinNT.HANDLEByReference[] pipeError = new WinNT.HANDLEByReference[] {
new WinNT.HANDLEByReference(Kernel32.INVALID_HANDLE_VALUE), new WinNT.HANDLEByReference(Kernel32.INVALID_HANDLE_VALUE) }; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | boolean success;
if (initHolder(stdHandles[0], pipeIn, OFFSET_READ, hStdInput)) {
if (initHolder(stdHandles[1], pipeOut, OFFSET_WRITE, hStdOutput)) {
WinBase.STARTUPINFO si = new WinBase.STARTUPINFO();
si.hStdInput = hStdInput.getValue();
si.hStdOutput = hStdOutput.getValue();
if (redirectErrorStream) {
si.hStdError = si.hStdOutput;
stdHandles[2].setValue(JAVA_INVALID_HANDLE_VALUE);
success = true;
} else {
success = initHolder(stdHandles[2], pipeError, OFFSET_WRITE, hStdError);
si.hStdError = hStdError.getValue();
}
if (success) {
WTypes.LPSTR lpEnvironment = envblock == null ? new WTypes.LPSTR() : new WTypes.LPSTR(envblock);
Kernel32.PROCESS_INFORMATION pi = new WinBase.PROCESS_INFORMATION();
si.dwFlags = Kernel32.STARTF_USESTDHANDLES;
if (!Advapi32.INSTANCE.CreateProcessWithLogonW(
username
, null
, password
, Advapi32.LOGON_WITH_PROFILE
, null
, cmd
, Kernel32.CREATE_NO_WINDOW
, lpEnvironment.getPointer()
, path
, si
, pi)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
} else {
closeHandle(pi.hThread);
ret = pi.hProcess;
}
}
releaseHolder(ret.getPointer().equals(Pointer.createConstant(0)), pipeError, OFFSET_WRITE);
releaseHolder(ret.getPointer().equals(Pointer.createConstant(0)), pipeOut, OFFSET_WRITE);
}
releaseHolder(ret.getPointer().equals(Pointer.createConstant(0)), pipeIn, OFFSET_READ);
}
restoreIOEHandleState(stdIOE, inherit);
return ret;
}
private static synchronized WinNT.HANDLE create(String username,
String password,
String cmd,
final String envblock,
final String path,
final long[] stdHandles,
final boolean redirectErrorStream) {
WinNT.HANDLE ret = new WinNT.HANDLE(Pointer.createConstant(0));
WinNT.HANDLEByReference[] handles = new WinNT.HANDLEByReference[stdHandles.length];
for (int i = 0; i < stdHandles.length; i++) {
handles[i] = new WinNT.HANDLEByReference(new WinNT.HANDLE(Pointer.createConstant(stdHandles[i])));
}
if (cmd != null) {
if (username != null && password != null) {
ret = processCreate(username, password, cmd, envblock, path, handles, redirectErrorStream);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | }
for (int i = 0; i < stdHandles.length; i++) {
stdHandles[i] = handles[i].getPointer().getLong(0);
}
return ret;
}
private static int getExitCodeProcess(WinNT.HANDLE handle) {
IntByReference exitStatus = new IntByReference();
if (!Kernel32.INSTANCE.GetExitCodeProcess(handle, exitStatus)) {
throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
}
return exitStatus.getValue();
}
private static void terminateProcess(WinNT.HANDLE handle) {
Kernel32.INSTANCE.TerminateProcess(handle, 1);
}
private static boolean isProcessAlive(WinNT.HANDLE handle) {
IntByReference exitStatus = new IntByReference();
Kernel32.INSTANCE.GetExitCodeProcess(handle, exitStatus);
return exitStatus.getValue() == STILL_ACTIVE;
}
private static void closeHandle(WinNT.HANDLE handle) {
Kernel32Util.closeHandle(handle);
}
/**
* Opens a file for atomic append. The file is created if it doesn't
* already exist.
*
* @param path the file to open or create
* @return the native HANDLE |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java | */
private static long openForAtomicAppend(String path) throws IOException {
int access = Kernel32.GENERIC_READ | Kernel32.GENERIC_WRITE;
int sharing = Kernel32.FILE_SHARE_READ | Kernel32.FILE_SHARE_WRITE;
int disposition = Kernel32.OPEN_ALWAYS;
int flagsAndAttributes = Kernel32.FILE_ATTRIBUTE_NORMAL;
if (path == null || path.isEmpty()) {
return -1;
} else {
WinNT.HANDLE handle = Kernel32.INSTANCE.CreateFile(path, access, sharing, null, disposition, flagsAndAttributes, null);
if (handle == Kernel32.INVALID_HANDLE_VALUE) {
throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
}
return handle.getPointer().getLong(0);
}
}
private static void waitForInterruptibly(WinNT.HANDLE handle) {
int result = Kernel32.INSTANCE.WaitForMultipleObjects(1, new WinNT.HANDLE[]{handle}, false, Kernel32.INFINITE);
if (result == Kernel32.WAIT_FAILED) {
throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
}
}
private static void waitForTimeoutInterruptibly(WinNT.HANDLE handle, long timeout) {
int result = Kernel32.INSTANCE.WaitForMultipleObjects(1, new WinNT.HANDLE[]{handle}, false, (int) timeout);
if (result == Kernel32.WAIT_FAILED) {
throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTaskTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.task.shell;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.DbType;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.server.worker.task.ShellCommandExecutor;
import org.apache.dolphinscheduler.server.worker.task.TaskProps;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.process.ProcessService; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTaskTest.java | import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import java.util.Date;
/**
* shell task test
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest(OSUtils.class)
public class ShellTaskTest {
private static final Logger logger = LoggerFactory.getLogger(ShellTaskTest.class);
private ShellTask shellTask;
private ProcessService processService;
private ShellCommandExecutor shellCommandExecutor;
private ApplicationContext applicationContext;
@Before
public void before() throws Exception {
PowerMockito.mockStatic(OSUtils.class);
processService = PowerMockito.mock(ProcessService.class);
shellCommandExecutor = PowerMockito.mock(ShellCommandExecutor.class);
applicationContext = PowerMockito.mock(ApplicationContext.class);
SpringApplicationContext springApplicationContext = new SpringApplicationContext(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTaskTest.java | springApplicationContext.setApplicationContext(applicationContext);
PowerMockito.when(applicationContext.getBean(ProcessService.class)).thenReturn(processService);
TaskProps props = new TaskProps();
props.setTaskDir("/tmp");
props.setTaskAppId(String.valueOf(System.currentTimeMillis()));
props.setTaskInstId(1);
props.setTenantCode("1");
props.setEnvFile(".dolphinscheduler_env.sh");
props.setTaskStartTime(new Date());
props.setTaskTimeout(0);
props.setTaskParams("{\"rawScript\": \" echo 'hello world!'\"}");
shellTask = new ShellTask(props, logger);
shellTask.init();
PowerMockito.when(processService.findDataSourceById(1)).thenReturn(getDataSource());
PowerMockito.when(processService.findDataSourceById(2)).thenReturn(getDataSource());
PowerMockito.when(processService.findProcessInstanceByTaskId(1)).thenReturn(getProcessInstance());
String fileName = String.format("%s/%s_node.%s", props.getTaskDir(), props.getTaskAppId(), OSUtils.isWindows() ? "bat" : "sh");
PowerMockito.when(shellCommandExecutor.run(fileName, processService)).thenReturn(0);
}
private DataSource getDataSource() {
DataSource dataSource = new DataSource();
dataSource.setType(DbType.MYSQL);
dataSource.setConnectionParams(
"{\"user\":\"root\",\"password\":\"123456\",\"address\":\"jdbc:mysql://127.0.0.1:3306\",\"database\":\"test\",\"jdbcUrl\":\"jdbc:mysql://127.0.0.1:3306/test\"}");
dataSource.setUserId(1);
return dataSource;
}
private ProcessInstance getProcessInstance() {
ProcessInstance processInstance = new ProcessInstance();
processInstance.setCommandType(CommandType.START_PROCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTaskTest.java | processInstance.setScheduleTime(new Date());
return processInstance;
}
@After
public void after() {}
/**
* Method: ShellTask()
*/
@Test
public void testShellTask()
throws Exception {
TaskProps props = new TaskProps();
props.setTaskDir("/tmp");
props.setTaskAppId(String.valueOf(System.currentTimeMillis()));
props.setTaskInstId(1);
props.setTenantCode("1");
ShellTask shellTaskTest = new ShellTask(props, logger);
Assert.assertNotNull(shellTaskTest);
}
/**
* Method: init for Unix-like
*/
@Test
public void testInitForUnix() {
try {
PowerMockito.when(OSUtils.isWindows()).thenReturn(false);
shellTask.init();
Assert.assertTrue(true);
} catch (Error | Exception e) {
logger.error(e.getMessage()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTaskTest.java | }
}
/**
* Method: init for Windows
*/
@Test
public void testInitForWindows() {
try {
PowerMockito.when(OSUtils.isWindows()).thenReturn(true);
shellTask.init();
Assert.assertTrue(true);
} catch (Error | Exception e) {
logger.error(e.getMessage());
}
}
/**
* Method: handle() for Unix-like
*/
@Test
public void testHandleForUnix() throws Exception {
try {
PowerMockito.when(OSUtils.isWindows()).thenReturn(false);
shellTask.handle();
Assert.assertTrue(true);
} catch (Error | Exception e) {
if (!e.getMessage().contains("process error . exitCode is : -1")
&& !System.getProperty("os.name").startsWith("Windows")) {
logger.error(e.getMessage());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,111 | [BUG] sun.misc.JavaIOFileDescriptorAccess is not portable | Current implementation relies on `sun.misc.JavaIOFileDescriptorAccess` which is only accessible on oraclejdk8.
Basically the demand is getting & setting `field` field of `FileDescriptor`, so we can directly do that with reflection.
Though, I suspect the necessity we introduce `ProcessImplForWin32`. Maybe we could have a better way to support worker server to run bat script. | https://github.com/apache/dolphinscheduler/issues/2111 | https://github.com/apache/dolphinscheduler/pull/2113 | 450a1f56fc73f088fce89a343a0b008706f2088c | 9224b49b58b756d22c75d8929108f716283282b4 | 2020-03-08T05:09:46Z | java | 2020-03-09T11:06:41Z | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTaskTest.java | }
/**
* Method: handle() for Windows
*/
@Test
public void testHandleForWindows() throws Exception {
try {
PowerMockito.when(OSUtils.isWindows()).thenReturn(true);
shellTask.handle();
Assert.assertTrue(true);
} catch (Error | Exception e) {
if (!e.getMessage().contains("process error . exitCode is : -1")) {
logger.error(e.getMessage());
}
}
}
/**
* Method: cancelApplication()
*/
@Test
public void testCancelApplication() throws Exception {
try {
shellTask.cancelApplication(true);
Assert.assertTrue(true);
} catch (Error | Exception e) {
logger.error(e.getMessage());
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.task.sql;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.dolphinscheduler.alert.utils.MailUtils;
import org.apache.dolphinscheduler.common.Constants; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.ShowType;
import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.common.enums.UdfType;
import org.apache.dolphinscheduler.common.process.Property;
import org.apache.dolphinscheduler.common.task.AbstractParameters;
import org.apache.dolphinscheduler.common.task.sql.SqlBinds;
import org.apache.dolphinscheduler.common.task.sql.SqlParameters;
import org.apache.dolphinscheduler.common.task.sql.SqlType;
import org.apache.dolphinscheduler.common.utils.*;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.datasource.BaseDataSource;
import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.UdfFunc;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.server.utils.ParamUtils;
import org.apache.dolphinscheduler.server.utils.UDFUtils;
import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
import org.apache.dolphinscheduler.server.worker.task.TaskProps;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.permission.PermissionCheck;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.slf4j.Logger;
import java.sql.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | import static org.apache.dolphinscheduler.common.Constants.*;
import static org.apache.dolphinscheduler.common.enums.DbType.HIVE;
/**
* sql task
*/
public class SqlTask extends AbstractTask {
/**
* sql parameters
*/
private SqlParameters sqlParameters;
/**
* process service
*/
private ProcessService processService;
/**
* alert dao
*/
private AlertDao alertDao;
/**
* datasource
*/
private DataSource dataSource;
/**
* base datasource
*/
private BaseDataSource baseDataSource;
public SqlTask(TaskProps taskProps, Logger logger) {
super(taskProps, logger);
logger.info("sql task params {}", taskProps.getTaskParams());
this.sqlParameters = JSON.parseObject(taskProps.getTaskParams(), SqlParameters.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | if (!sqlParameters.checkParameters()) {
throw new RuntimeException("sql task params is not valid");
}
this.processService = SpringApplicationContext.getBean(ProcessService.class);
this.alertDao = SpringApplicationContext.getBean(AlertDao.class);
}
@Override
public void handle() throws Exception {
String threadLoggerInfoName = String.format(Constants.TASK_LOG_INFO_FORMAT, taskProps.getTaskAppId());
Thread.currentThread().setName(threadLoggerInfoName);
logger.info("Full sql parameters: {}", sqlParameters);
logger.info("sql type : {}, datasource : {}, sql : {} , localParams : {},udfs : {},showType : {},connParams : {}",
sqlParameters.getType(),
sqlParameters.getDatasource(),
sqlParameters.getSql(),
sqlParameters.getLocalParams(),
sqlParameters.getUdfs(),
sqlParameters.getShowType(),
sqlParameters.getConnParams());
if (sqlParameters.getDatasource() == 0){
logger.error("datasource id not exists");
exitStatusCode = -1;
return;
}
dataSource= processService.findDataSourceById(sqlParameters.getDatasource());
if (dataSource == null){
logger.error("datasource not exists"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | exitStatusCode = -1;
return;
}
logger.info("datasource name : {} , type : {} , desc : {} , user_id : {} , parameter : {}",
dataSource.getName(),
dataSource.getType(),
dataSource.getNote(),
dataSource.getUserId(),
dataSource.getConnectionParams());
List<String> createFuncs = null;
try {
DataSourceFactory.loadClass(dataSource.getType());
baseDataSource = DataSourceFactory.getDatasource(dataSource.getType(),
dataSource.getConnectionParams());
SqlBinds mainSqlBinds = getSqlAndSqlParamsMap(sqlParameters.getSql());
List<SqlBinds> preStatementSqlBinds = Optional.ofNullable(sqlParameters.getPreStatements())
.orElse(new ArrayList<>())
.stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList());
List<SqlBinds> postStatementSqlBinds = Optional.ofNullable(sqlParameters.getPostStatements())
.orElse(new ArrayList<>())
.stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList());
boolean udfTypeFlag = EnumUtils.isValidEnum(UdfType.class, sqlParameters.getType()) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | && StringUtils.isNotEmpty(sqlParameters.getUdfs());
if(udfTypeFlag){
String[] ids = sqlParameters.getUdfs().split(",");
int[] idsArray = new int[ids.length];
for(int i=0;i<ids.length;i++){
idsArray[i]=Integer.parseInt(ids[i]);
}
checkUdfPermission(ArrayUtils.toObject(idsArray));
List<UdfFunc> udfFuncList = processService.queryUdfFunListByids(idsArray);
createFuncs = UDFUtils.createFuncs(udfFuncList, taskProps.getTenantCode(), logger);
}
executeFuncAndSql(mainSqlBinds, preStatementSqlBinds, postStatementSqlBinds, createFuncs);
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw e;
}
}
/**
* ready to execute SQL and parameter entity Map
* @return
*/
private SqlBinds getSqlAndSqlParamsMap(String sql) {
Map<Integer,Property> sqlParamsMap = new HashMap<>();
StringBuilder sqlBuilder = new StringBuilder();
Map<String, Property> paramsMap = ParamUtils.convert(taskProps.getUserDefParamsMap(),
taskProps.getDefinedParams(),
sqlParameters.getLocalParametersMap(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | taskProps.getCmdTypeIfComplement(),
taskProps.getScheduleTime());
if(paramsMap == null){
sqlBuilder.append(sql);
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap);
}
if (StringUtils.isNotEmpty(sqlParameters.getTitle())){
String title = ParameterUtils.convertParameterPlaceholders(sqlParameters.getTitle(),
ParamUtils.convert(paramsMap));
logger.info("SQL title : {}",title);
sqlParameters.setTitle(title);
}
sql = ParameterUtils.replaceScheduleTime(sql, taskProps.getScheduleTime(), paramsMap);
String rgex = "['\"]*\\$\\{(.*?)\\}['\"]*";
setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap);
String formatSql = sql.replaceAll(rgex,"?");
sqlBuilder.append(formatSql);
printReplacedSql(sql,formatSql,rgex,sqlParamsMap);
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap);
}
@Override
public AbstractParameters getParameters() {
return this.sqlParameters;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | /**
* execute function and sql
* @param mainSqlBinds main sql binds
* @param preStatementsBinds pre statements binds
* @param postStatementsBinds post statements binds
* @param createFuncs create functions
*/
public void executeFuncAndSql(SqlBinds mainSqlBinds,
List<SqlBinds> preStatementsBinds,
List<SqlBinds> postStatementsBinds,
List<String> createFuncs){
Connection connection = null;
try {
CommonUtils.loadKerberosConf();
if (HIVE == dataSource.getType()) {
Properties paramProp = new Properties();
paramProp.setProperty(USER, baseDataSource.getUser());
paramProp.setProperty(PASSWORD, baseDataSource.getPassword());
Map<String, String> connParamMap = CollectionUtils.stringToMap(sqlParameters.getConnParams(),
SEMICOLON,
HIVE_CONF);
paramProp.putAll(connParamMap);
connection = DriverManager.getConnection(baseDataSource.getJdbcUrl(),
paramProp);
}else{
connection = DriverManager.getConnection(baseDataSource.getJdbcUrl(),
baseDataSource.getUser(),
baseDataSource.getPassword()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | }
if (CollectionUtils.isNotEmpty(createFuncs)) {
try (Statement funcStmt = connection.createStatement()) {
for (String createFunc : createFuncs) {
logger.info("hive create function sql: {}", createFunc);
funcStmt.execute(createFunc);
}
}
}
for (SqlBinds sqlBind: preStatementsBinds) {
try (PreparedStatement stmt = prepareStatementAndBind(connection, sqlBind)) {
int result = stmt.executeUpdate();
logger.info("pre statement execute result: {}, for sql: {}",result,sqlBind.getSql());
}
}
try (PreparedStatement stmt = prepareStatementAndBind(connection, mainSqlBinds);
ResultSet resultSet = stmt.executeQuery()) {
if (sqlParameters.getSqlType() == SqlType.QUERY.ordinal()) {
JSONArray resultJSONArray = new JSONArray();
ResultSetMetaData md = resultSet.getMetaData();
int num = md.getColumnCount();
while (resultSet.next()) {
JSONObject mapOfColValues = new JSONObject(true);
for (int i = 1; i <= num; i++) {
mapOfColValues.put(md.getColumnName(i), resultSet.getObject(i));
}
resultJSONArray.add(mapOfColValues); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | }
logger.debug("execute sql : {}", JSON.toJSONString(resultJSONArray, SerializerFeature.WriteMapNullValue));
if ( !resultJSONArray.isEmpty() ) {
if (StringUtils.isNotEmpty(sqlParameters.getTitle())) {
sendAttachment(sqlParameters.getTitle(),
JSON.toJSONString(resultJSONArray, SerializerFeature.WriteMapNullValue));
}else{
sendAttachment(taskProps.getNodeName() + " query resultsets ",
JSON.toJSONString(resultJSONArray, SerializerFeature.WriteMapNullValue));
}
}
exitStatusCode = 0;
} else if (sqlParameters.getSqlType() == SqlType.NON_QUERY.ordinal()) {
stmt.executeUpdate();
exitStatusCode = 0;
}
}
for (SqlBinds sqlBind: postStatementsBinds) {
try (PreparedStatement stmt = prepareStatementAndBind(connection, sqlBind)) {
int result = stmt.executeUpdate();
logger.info("post statement execute result: {},for sql: {}",result,sqlBind.getSql());
}
}
} catch (Exception e) {
logger.error(e.getMessage(),e);
throw new RuntimeException(e.getMessage());
} finally {
ConnectionUtils.releaseResource(connection); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | }
}
/**
* preparedStatement bind
* @param connection
* @param sqlBinds
* @return
* @throws Exception
*/
private PreparedStatement prepareStatementAndBind(Connection connection, SqlBinds sqlBinds) throws Exception {
boolean timeoutFlag = taskProps.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED ||
taskProps.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED;
PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql());
if(timeoutFlag){
stmt.setQueryTimeout(taskProps.getTaskTimeout());
}
Map<Integer, Property> params = sqlBinds.getParamsMap();
if(params != null) {
for (Map.Entry<Integer, Property> entry : params.entrySet()) {
Property prop = entry.getValue();
ParameterUtils.setInParameter(entry.getKey(), stmt, prop.getType(), prop.getValue());
}
}
logger.info("prepare statement replace sql : {} ", stmt);
return stmt;
}
/**
* send mail as an attachment |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | * @param title title
* @param content content
*/
public void sendAttachment(String title,String content){
ProcessInstance instance = processService.findProcessInstanceByTaskId(taskProps.getTaskInstId());
List<User> users = alertDao.queryUserByAlertGroupId(instance.getWarningGroupId());
List<String> receviersList = new ArrayList<>();
for(User user:users){
receviersList.add(user.getEmail().trim());
}
String receivers = sqlParameters.getReceivers();
if (StringUtils.isNotEmpty(receivers)){
String[] splits = receivers.split(COMMA);
for (String receiver : splits){
receviersList.add(receiver.trim());
}
}
List<String> receviersCcList = new ArrayList<>();
String receiversCc = sqlParameters.getReceiversCc();
if (StringUtils.isNotEmpty(receiversCc)){
String[] splits = receiversCc.split(COMMA);
for (String receiverCc : splits){
receviersCcList.add(receiverCc.trim());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | String showTypeName = sqlParameters.getShowType().replace(COMMA,"").trim();
if(EnumUtils.isValidEnum(ShowType.class,showTypeName)){
Map<String, Object> mailResult = MailUtils.sendMails(receviersList,
receviersCcList, title, content, ShowType.valueOf(showTypeName));
if(!(boolean) mailResult.get(STATUS)){
throw new RuntimeException("send mail failed!");
}
}else{
logger.error("showType: {} is not valid " ,showTypeName);
throw new RuntimeException(String.format("showType: %s is not valid ",showTypeName));
}
}
/**
* regular expressions match the contents between two specified strings
* @param content content
* @param rgex rgex
* @param sqlParamsMap sql params map
* @param paramsPropsMap params props map
*/
public void setSqlParamsMap(String content, String rgex, Map<Integer,Property> sqlParamsMap, Map<String,Property> paramsPropsMap){
Pattern pattern = Pattern.compile(rgex);
Matcher m = pattern.matcher(content);
int index = 1;
while (m.find()) {
String paramName = m.group(1);
Property prop = paramsPropsMap.get(paramName);
sqlParamsMap.put(index,prop);
index ++;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,178 | [BUG] SqlTask kerberos authentication process | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
When the keytab is expired or deactivated, other tasks that did not require authentication also failed. Obviously there is something wrong with the kerberos authentication process and it should only do it when it is needed.
**Which version of Dolphin Scheduler:**
-[1.2.1-release]
**Requirement or improvement
- Change CommonUtils.loadKerberosConf() call scope;
| https://github.com/apache/dolphinscheduler/issues/2178 | https://github.com/apache/dolphinscheduler/pull/2321 | a851168a350e300becb3452e91871220ffa3a5fc | d4735334a1986fedd5b92d185dc6d46be93cb071 | 2020-03-14T11:25:36Z | java | 2020-03-28T09:42:33Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | /**
* print replace sql
* @param content content
* @param formatSql format sql
* @param rgex rgex
* @param sqlParamsMap sql params map
*/
public void printReplacedSql(String content, String formatSql,String rgex, Map<Integer,Property> sqlParamsMap){
logger.info("after replace sql , preparing : {}" , formatSql);
StringBuilder logPrint = new StringBuilder("replaced sql , parameters:");
for(int i=1;i<=sqlParamsMap.size();i++){
logPrint.append(sqlParamsMap.get(i).getValue()+"("+sqlParamsMap.get(i).getType()+")");
}
logger.info("Sql Params are {}", logPrint);
}
/**
* check udf function permission
* @param udfFunIds udf functions
* @return if has download permission return true else false
*/
private void checkUdfPermission(Integer[] udfFunIds) throws Exception{
ProcessInstance processInstance = processService.findProcessInstanceByTaskId(taskProps.getTaskInstId());
int userId = processInstance.getExecutorId();
PermissionCheck<Integer> permissionCheckUdf = new PermissionCheck<>(AuthorizationType.UDF, processService,udfFunIds,userId,logger);
permissionCheckUdf.checkPermission();
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentExecute.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentExecute.java | * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.task.dependent;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.DependResult;
import org.apache.dolphinscheduler.common.enums.DependentRelation;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.model.DateInterval;
import org.apache.dolphinscheduler.common.model.DependentItem;
import org.apache.dolphinscheduler.common.utils.DependentUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
/**
* dependent item execute
*/
public class DependentExecute { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentExecute.java | /**
* process service
*/
private final ProcessService processService = SpringApplicationContext.getBean(ProcessService.class);
/**
* depend item list
*/
private List<DependentItem> dependItemList;
/**
* dependent relation
*/
private DependentRelation relation;
/**
* depend result
*/
private DependResult modelDependResult = DependResult.WAITING;
/**
* depend result map
*/
private Map<String, DependResult> dependResultMap = new HashMap<>();
/**
* logger
*/
private Logger logger = LoggerFactory.getLogger(DependentExecute.class);
/**
* constructor |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentExecute.java | * @param itemList item list
* @param relation relation
*/
public DependentExecute(List<DependentItem> itemList, DependentRelation relation){
this.dependItemList = itemList;
this.relation = relation;
}
/**
* get dependent item for one dependent item
* @param dependentItem dependent item
* @param currentTime current time
* @return DependResult
*/
public DependResult getDependentResultForItem(DependentItem dependentItem, Date currentTime){
List<DateInterval> dateIntervals = DependentUtils.getDateIntervalList(currentTime, dependentItem.getDateValue());
return calculateResultForTasks(dependentItem, dateIntervals );
}
/**
* calculate dependent result for one dependent item.
* @param dependentItem dependent item
* @param dateIntervals date intervals
* @return dateIntervals
*/
private DependResult calculateResultForTasks(DependentItem dependentItem,
List<DateInterval> dateIntervals) {
DependResult result = DependResult.FAILED;
for(DateInterval dateInterval : dateIntervals){
ProcessInstance processInstance = findLastProcessInterval(dependentItem.getDefinitionId(),
dateInterval);
if(processInstance == null){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentExecute.java | logger.error("cannot find the right process instance: definition id:{}, start:{}, end:{}",
dependentItem.getDefinitionId(), dateInterval.getStartTime(), dateInterval.getEndTime() );
return DependResult.FAILED;
}
if(dependentItem.getDepTasks().equals(Constants.DEPENDENT_ALL)){
result = getDependResultByState(processInstance.getState());
}else{
TaskInstance taskInstance = null;
List<TaskInstance> taskInstanceList = processService.findValidTaskListByProcessId(processInstance.getId());
for(TaskInstance task : taskInstanceList){
if(task.getName().equals(dependentItem.getDepTasks())){
taskInstance = task;
break;
}
}
if(taskInstance == null){
result = getDependResultByState(processInstance.getState());
}else{
result = getDependResultByState(taskInstance.getState());
}
}
if(result != DependResult.SUCCESS){
break;
}
}
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentExecute.java | * find the last one process instance that :
* 1. manual run and finish between the interval
* 2. schedule run and schedule time between the interval
* @param definitionId definition id
* @param dateInterval date interval
* @return ProcessInstance
*/
private ProcessInstance findLastProcessInterval(int definitionId, DateInterval dateInterval) {
ProcessInstance runningProcess = processService.findLastRunningProcess(definitionId, dateInterval);
if(runningProcess != null){
return runningProcess;
}
ProcessInstance lastSchedulerProcess = processService.findLastSchedulerProcessInterval(
definitionId, dateInterval
);
ProcessInstance lastManualProcess = processService.findLastManualProcessInterval(
definitionId, dateInterval
);
if(lastManualProcess ==null){
return lastSchedulerProcess;
}
if(lastSchedulerProcess == null){
return lastManualProcess;
}
return (lastManualProcess.getEndTime().after(lastSchedulerProcess.getEndTime()))?
lastManualProcess : lastSchedulerProcess;
}
/**
* get dependent result by task/process instance state
* @param state state |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentExecute.java | * @return DependResult
*/
private DependResult getDependResultByState(ExecutionStatus state) {
if(state.typeIsRunning() || state == ExecutionStatus.SUBMITTED_SUCCESS || state == ExecutionStatus.WAITTING_THREAD){
return DependResult.WAITING;
}else if(state.typeIsSuccess()){
return DependResult.SUCCESS;
}else{
return DependResult.FAILED;
}
}
/**
* judge depend item finished
* @param currentTime current time
* @return boolean
*/
public boolean finish(Date currentTime){
if(modelDependResult == DependResult.WAITING){
modelDependResult = getModelDependResult(currentTime);
return false;
}
return true;
}
/**
* get model depend result
* @param currentTime current time
* @return DependResult
*/
public DependResult getModelDependResult(Date currentTime){
List<DependResult> dependResultList = new ArrayList<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentExecute.java | for(DependentItem dependentItem : dependItemList){
DependResult dependResult = getDependResultForItem(dependentItem, currentTime);
if(dependResult != DependResult.WAITING){
dependResultMap.put(dependentItem.getKey(), dependResult);
}
dependResultList.add(dependResult);
}
modelDependResult = DependentUtils.getDependResultForRelation(
this.relation, dependResultList
);
return modelDependResult;
}
/**
* get dependent item result
* @param item item
* @param currentTime current time
* @return DependResult
*/
public DependResult getDependResultForItem(DependentItem item, Date currentTime){
String key = item.getKey();
if(dependResultMap.containsKey(key)){
return dependResultMap.get(key);
}
return getDependentResultForItem(item, currentTime);
}
public Map<String, DependResult> getDependResultMap(){
return dependResultMap;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTask.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTask.java | * limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.task.dependent;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.DependResult;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.model.DependentTaskModel;
import org.apache.dolphinscheduler.common.task.AbstractParameters;
import org.apache.dolphinscheduler.common.task.dependent.DependentParameters;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.DependentUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
import org.apache.dolphinscheduler.server.worker.task.TaskProps;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.slf4j.Logger;
import java.util.*;
import static org.apache.dolphinscheduler.common.Constants.DEPENDENT_SPLIT;
/**
* Dependent Task
*/
public class DependentTask extends AbstractTask {
/**
* dependent task list
*/
private List<DependentExecute> dependentTaskList = new ArrayList<>();
/**
* depend item result map |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTask.java | * save the result to log file
*/
private Map<String, DependResult> dependResultMap = new HashMap<>();
/**
* dependent parameters
*/
private DependentParameters dependentParameters;
/**
* dependent date
*/
private Date dependentDate;
/**
* process service
*/
private ProcessService processService;
/**
* constructor
* @param props props
* @param logger logger
*/
public DependentTask(TaskProps props, Logger logger) {
super(props, logger);
}
@Override
public void init(){
logger.info("dependent task initialize");
this.dependentParameters = JSONUtils.parseObject(this.taskProps.getDependence(),
DependentParameters.class);
for(DependentTaskModel taskModel : dependentParameters.getDependTaskList()){
this.dependentTaskList.add(new DependentExecute( |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTask.java | taskModel.getDependItemList(), taskModel.getRelation()));
}
this.processService = SpringApplicationContext.getBean(ProcessService.class);
if(taskProps.getScheduleTime() != null){
this.dependentDate = taskProps.getScheduleTime();
}else{
this.dependentDate = taskProps.getTaskStartTime();
}
}
@Override
public void handle() throws Exception {
String threadLoggerInfoName = String.format(Constants.TASK_LOG_INFO_FORMAT, taskProps.getTaskAppId());
Thread.currentThread().setName(threadLoggerInfoName);
try{
TaskInstance taskInstance = null;
while(Stopper.isRunning()){
taskInstance = processService.findTaskInstanceById(this.taskProps.getTaskInstId());
if(taskInstance == null){
exitStatusCode = -1;
break;
}
if(taskInstance.getState() == ExecutionStatus.KILL){
this.cancel = true;
}
if(this.cancel || allDependentTaskFinish()){
break;
}
Thread.sleep(Constants.SLEEP_TIME_MILLIS);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTask.java | if(cancel){
exitStatusCode = Constants.EXIT_CODE_KILL;
}else{
DependResult result = getTaskDependResult();
exitStatusCode = (result == DependResult.SUCCESS) ?
Constants.EXIT_CODE_SUCCESS : Constants.EXIT_CODE_FAILURE;
}
}catch (Exception e){
logger.error(e.getMessage(),e);
exitStatusCode = -1;
throw e;
}
}
/**
* get dependent result
* @return DependResult
*/
private DependResult getTaskDependResult(){
List<DependResult> dependResultList = new ArrayList<>();
for(DependentExecute dependentExecute : dependentTaskList){
DependResult dependResult = dependentExecute.getModelDependResult(dependentDate);
dependResultList.add(dependResult);
}
DependResult result = DependentUtils.getDependResultForRelation(
this.dependentParameters.getRelation(), dependResultList
);
return result;
}
/**
* judge all dependent tasks finish |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTask.java | * @return whether all dependent tasks finish
*/
private boolean allDependentTaskFinish(){
boolean finish = true;
for(DependentExecute dependentExecute : dependentTaskList){
for(Map.Entry<String, DependResult> entry: dependentExecute.getDependResultMap().entrySet()) {
if(!dependResultMap.containsKey(entry.getKey())){
dependResultMap.put(entry.getKey(), entry.getValue());
logger.info("dependent item complete {} {},{}",
DEPENDENT_SPLIT, entry.getKey(), entry.getValue().toString());
}
}
if(!dependentExecute.finish(dependentDate)){
finish = false;
}
}
return finish;
}
@Override
public void cancelApplication(boolean cancelApplication) throws Exception {
this.cancel = true;
}
@Override
public AbstractParameters getParameters() {
return null;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTaskTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.task.dependent;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.server.worker.task.TaskProps;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DependentTaskTest { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTaskTest.java | private static final Logger logger = LoggerFactory.getLogger(DependentTaskTest.class);
@Test
public void testDependInit() throws Exception{
TaskProps taskProps = new TaskProps();
String dependString = "{\n" +
"\"dependTaskList\":[\n" +
" {\n" +
" \"dependItemList\":[\n" +
" {\n" +
" \"definitionId\": 101,\n" +
" \"depTasks\": \"ALL\",\n" +
" \"cycle\": \"day\",\n" +
" \"dateValue\": \"last1Day\"\n" +
" }\n" +
" ],\n" +
" \"relation\": \"AND\"\n" +
" }\n" +
" ],\n" +
"\"relation\":\"OR\"\n" +
"}";
taskProps.setTaskInstId(252612);
taskProps.setDependence(dependString);
DependentTask dependentTask = new DependentTask(taskProps, logger);
dependentTask.init();
dependentTask.handle();
Assert.assertEquals(dependentTask.getExitStatusCode(), Constants.EXIT_CODE_FAILURE );
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | package org.apache.dolphinscheduler.service.process;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cronutils.model.Cron;
import org.apache.commons.lang.ArrayUtils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.*;
import org.apache.dolphinscheduler.common.model.DateInterval;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.process.Property;
import org.apache.dolphinscheduler.common.task.subprocess.SubProcessParameters;
import org.apache.dolphinscheduler.common.utils.*;
import org.apache.dolphinscheduler.dao.entity.*;
import org.apache.dolphinscheduler.dao.mapper.*;
import org.apache.dolphinscheduler.service.quartz.cron.CronUtils;
import org.apache.dolphinscheduler.service.queue.ITaskQueue;
import org.quartz.CronExpression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toSet;
import static org.apache.dolphinscheduler.common.Constants.*;
/**
* process relative dao that some mappers in this.
*/
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | public class ProcessService {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final int[] stateArray = new int[]{ExecutionStatus.SUBMITTED_SUCCESS.ordinal(),
ExecutionStatus.RUNNING_EXEUTION.ordinal(),
ExecutionStatus.READY_PAUSE.ordinal(),
ExecutionStatus.READY_STOP.ordinal()};
@Autowired
private UserMapper userMapper;
@Autowired
private ProcessDefinitionMapper processDefineMapper;
@Autowired
private ProcessInstanceMapper processInstanceMapper;
@Autowired
private DataSourceMapper dataSourceMapper;
@Autowired
private ProcessInstanceMapMapper processInstanceMapMapper;
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | private TaskInstanceMapper taskInstanceMapper;
@Autowired
private CommandMapper commandMapper;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private UdfFuncMapper udfFuncMapper;
@Autowired
private ResourceMapper resourceMapper;
@Autowired
private WorkerGroupMapper workerGroupMapper;
@Autowired
private ErrorCommandMapper errorCommandMapper;
@Autowired
private TenantMapper tenantMapper;
@Autowired
private ProjectMapper projectMapper;
/**
* task queue impl
*/
@Autowired
private ITaskQueue taskQueue;
/**
* handle Command (construct ProcessInstance from Command) , wrapped in transaction
* @param logger logger
* @param host host
* @param validThreadNum validThreadNum
* @param command found command
* @return process instance
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | @Transactional(rollbackFor = Exception.class)
public ProcessInstance handleCommand(Logger logger, String host, int validThreadNum, Command command) {
ProcessInstance processInstance = constructProcessInstance(command, host);
if(processInstance == null){
logger.error("scan command, command parameter is error: {}", command);
moveToErrorCommand(command, "process instance is null");
return null;
}
if(!checkThreadNum(command, validThreadNum)){
logger.info("there is not enough thread for this command: {}", command);
return setWaitingThreadProcess(command, processInstance);
}
processInstance.setCommandType(command.getCommandType());
processInstance.addHistoryCmd(command.getCommandType());
saveProcessInstance(processInstance);
this.setSubProcessParam(processInstance);
delCommandByid(command.getId());
return processInstance;
}
/**
* save error command, and delete original command
* @param command command
* @param message message
*/
@Transactional(rollbackFor = Exception.class)
public void moveToErrorCommand(Command command, String message) {
ErrorCommand errorCommand = new ErrorCommand(command, message);
this.errorCommandMapper.insert(errorCommand);
delCommandByid(command.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* set process waiting thread
* @param command command
* @param processInstance processInstance
* @return process instance
*/
private ProcessInstance setWaitingThreadProcess(Command command, ProcessInstance processInstance) {
processInstance.setState(ExecutionStatus.WAITTING_THREAD);
if(command.getCommandType() != CommandType.RECOVER_WAITTING_THREAD){
processInstance.addHistoryCmd(command.getCommandType());
}
saveProcessInstance(processInstance);
this.setSubProcessParam(processInstance);
createRecoveryWaitingThreadCommand(command, processInstance);
return null;
}
/**
* check thread num
* @param command command
* @param validThreadNum validThreadNum
* @return if thread is enough
*/
private boolean checkThreadNum(Command command, int validThreadNum) {
int commandThreadCount = this.workProcessThreadNumCount(command.getProcessDefinitionId());
return validThreadNum >= commandThreadCount;
}
/**
* insert one command
* @param command command |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @return create result
*/
public int createCommand(Command command) {
int result = 0;
if (command != null){
result = commandMapper.insert(command);
}
return result;
}
/**
* find one command from queue list
* @return command
*/
public Command findOneCommand(){
return commandMapper.getOneToRun();
}
/**
* check the input command exists in queue list
* @param command command
* @return create command result
*/
public Boolean verifyIsNeedCreateCommand(Command command){
Boolean isNeedCreate = true;
Map<CommandType,Integer> cmdTypeMap = new HashMap<CommandType,Integer>();
cmdTypeMap.put(CommandType.REPEAT_RUNNING,1);
cmdTypeMap.put(CommandType.RECOVER_SUSPENDED_PROCESS,1);
cmdTypeMap.put(CommandType.START_FAILURE_TASK_PROCESS,1);
CommandType commandType = command.getCommandType();
if(cmdTypeMap.containsKey(commandType)){
JSONObject cmdParamObj = (JSONObject) JSON.parse(command.getCommandParam()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | JSONObject tempObj;
int processInstanceId = cmdParamObj.getInteger(CMDPARAM_RECOVER_PROCESS_ID_STRING);
List<Command> commands = commandMapper.selectList(null);
for (Command tmpCommand:commands){
if(cmdTypeMap.containsKey(tmpCommand.getCommandType())){
tempObj = (JSONObject) JSON.parse(tmpCommand.getCommandParam());
if(tempObj != null && processInstanceId == tempObj.getInteger(CMDPARAM_RECOVER_PROCESS_ID_STRING)){
isNeedCreate = false;
break;
}
}
}
}
return isNeedCreate;
}
/**
* find process instance detail by id
* @param processId processId
* @return process instance
*/
public ProcessInstance findProcessInstanceDetailById(int processId){
return processInstanceMapper.queryDetailById(processId);
}
/**
* find process instance by id
* @param processId processId
* @return process instance
*/
public ProcessInstance findProcessInstanceById(int processId){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return processInstanceMapper.selectById(processId);
}
/**
* find process define by id.
* @param processDefinitionId processDefinitionId
* @return process definition
*/
public ProcessDefinition findProcessDefineById(int processDefinitionId) {
return processDefineMapper.selectById(processDefinitionId);
}
/**
* delete work process instance by id
* @param processInstanceId processInstanceId
* @return delete process instance result
*/
public int deleteWorkProcessInstanceById(int processInstanceId){
return processInstanceMapper.deleteById(processInstanceId);
}
/**
* delete all sub process by parent instance id
* @param processInstanceId processInstanceId
* @return delete all sub process instance result
*/
public int deleteAllSubWorkProcessByParentId(int processInstanceId){
List<Integer> subProcessIdList = processInstanceMapMapper.querySubIdListByParentId(processInstanceId);
for(Integer subId : subProcessIdList ){
deleteAllSubWorkProcessByParentId(subId);
deleteWorkProcessMapByParentId(subId);
deleteWorkProcessInstanceById(subId);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return 1;
}
/**
* calculate sub process number in the process define.
* @param processDefinitionId processDefinitionId
* @return process thread num count
*/
private Integer workProcessThreadNumCount(Integer processDefinitionId){
List<Integer> ids = new ArrayList<>();
recurseFindSubProcessId(processDefinitionId, ids);
return ids.size()+1;
}
/**
* recursive query sub process definition id by parent id.
* @param parentId parentId
* @param ids ids
*/
public void recurseFindSubProcessId(int parentId, List<Integer> ids){
ProcessDefinition processDefinition = processDefineMapper.selectById(parentId);
String processDefinitionJson = processDefinition.getProcessDefinitionJson();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
List<TaskNode> taskNodeList = processData.getTasks();
if (taskNodeList != null && taskNodeList.size() > 0){
for (TaskNode taskNode : taskNodeList){
String parameter = taskNode.getParams();
if (parameter.contains(CMDPARAM_SUB_PROCESS_DEFINE_ID)){
SubProcessParameters subProcessParam = JSON.parseObject(parameter, SubProcessParameters.class);
ids.add(subProcessParam.getProcessDefinitionId());
recurseFindSubProcessId(subProcessParam.getProcessDefinitionId(),ids);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
}
}
/**
* create recovery waiting thread command when thread pool is not enough for the process instance.
* sub work process instance need not to create recovery command.
* create recovery waiting thread command and delete origin command at the same time.
* if the recovery command is exists, only update the field update_time
* @param originCommand originCommand
* @param processInstance processInstance
*/
public void createRecoveryWaitingThreadCommand(Command originCommand, ProcessInstance processInstance) {
if(processInstance.getIsSubProcess() == Flag.YES){
if(originCommand != null){
commandMapper.deleteById(originCommand.getId());
}
return;
}
Map<String, String> cmdParam = new HashMap<>();
cmdParam.put(Constants.CMDPARAM_RECOVERY_WAITTING_THREAD, String.valueOf(processInstance.getId()));
if(originCommand == null){
Command command = new Command(
CommandType.RECOVER_WAITTING_THREAD,
processInstance.getTaskDependType(),
processInstance.getFailureStrategy(),
processInstance.getExecutorId(),
processInstance.getProcessDefinitionId(),
JSONUtils.toJson(cmdParam), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processInstance.getWarningType(),
processInstance.getWarningGroupId(),
processInstance.getScheduleTime(),
processInstance.getProcessInstancePriority()
);
saveCommand(command);
return ;
}
if(originCommand.getCommandType() == CommandType.RECOVER_WAITTING_THREAD){
originCommand.setUpdateTime(new Date());
saveCommand(originCommand);
}else{
commandMapper.deleteById(originCommand.getId());
originCommand.setId(0);
originCommand.setCommandType(CommandType.RECOVER_WAITTING_THREAD);
originCommand.setUpdateTime(new Date());
originCommand.setCommandParam(JSONUtils.toJson(cmdParam));
originCommand.setProcessInstancePriority(processInstance.getProcessInstancePriority());
saveCommand(originCommand);
}
}
/**
* get schedule time from command
* @param command command
* @param cmdParam cmdParam map
* @return date
*/
private Date getScheduleTime(Command command, Map<String, String> cmdParam){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | Date scheduleTime = command.getScheduleTime();
if(scheduleTime == null){
if(cmdParam != null && cmdParam.containsKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)){
scheduleTime = DateUtils.stringToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE));
}
}
return scheduleTime;
}
/**
* generate a new work process instance from command.
* @param processDefinition processDefinition
* @param command command
* @param cmdParam cmdParam map
* @return process instance
*/
private ProcessInstance generateNewProcessInstance(ProcessDefinition processDefinition,
Command command,
Map<String, String> cmdParam){
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.setState(ExecutionStatus.RUNNING_EXEUTION);
processInstance.setRecovery(Flag.NO);
processInstance.setStartTime(new Date());
processInstance.setRunTimes(1);
processInstance.setMaxTryTimes(0);
processInstance.setProcessDefinitionId(command.getProcessDefinitionId());
processInstance.setCommandParam(command.getCommandParam());
processInstance.setCommandType(command.getCommandType());
processInstance.setIsSubProcess(Flag.NO);
processInstance.setTaskDependType(command.getTaskDependType());
processInstance.setFailureStrategy(command.getFailureStrategy()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processInstance.setExecutorId(command.getExecutorId());
WarningType warningType = command.getWarningType() == null ? WarningType.NONE : command.getWarningType();
processInstance.setWarningType(warningType);
Integer warningGroupId = command.getWarningGroupId() == null ? 0 : command.getWarningGroupId();
processInstance.setWarningGroupId(warningGroupId);
Date scheduleTime = getScheduleTime(command, cmdParam);
if(scheduleTime != null){
processInstance.setScheduleTime(scheduleTime);
}
processInstance.setCommandStartTime(command.getStartTime());
processInstance.setLocations(processDefinition.getLocations());
processInstance.setConnects(processDefinition.getConnects());
processInstance.setGlobalParams(ParameterUtils.curingGlobalParams(
processDefinition.getGlobalParamMap(),
processDefinition.getGlobalParamList(),
getCommandTypeIfComplement(processInstance, command),
processInstance.getScheduleTime()));
processInstance.setProcessInstanceJson(processDefinition.getProcessDefinitionJson());
processInstance.setProcessInstancePriority(command.getProcessInstancePriority());
int workerGroupId = command.getWorkerGroupId() == 0 ? -1 : command.getWorkerGroupId();
processInstance.setWorkerGroupId(workerGroupId);
processInstance.setTimeout(processDefinition.getTimeout());
processInstance.setTenantId(processDefinition.getTenantId());
return processInstance;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * get process tenant
* there is tenant id in definition, use the tenant of the definition.
* if there is not tenant id in the definiton or the tenant not exist
* use definition creator's tenant.
* @param tenantId tenantId
* @param userId userId
* @return tenant
*/
public Tenant getTenantForProcess(int tenantId, int userId){
Tenant tenant = null;
if(tenantId >= 0){
tenant = tenantMapper.queryById(tenantId);
}
if (userId == 0){
return null;
}
if(tenant == null){
User user = userMapper.selectById(userId);
tenant = tenantMapper.queryById(user.getTenantId());
}
return tenant;
}
/**
* check command parameters is valid
* @param command command
* @param cmdParam cmdParam map
* @return whether command param is valid
*/
private Boolean checkCmdParam(Command command, Map<String, String> cmdParam){
if(command.getTaskDependType() == TaskDependType.TASK_ONLY || command.getTaskDependType()== TaskDependType.TASK_PRE){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if(cmdParam == null
|| !cmdParam.containsKey(Constants.CMDPARAM_START_NODE_NAMES)
|| cmdParam.get(Constants.CMDPARAM_START_NODE_NAMES).isEmpty()){
logger.error("command node depend type is {}, but start nodes is null ", command.getTaskDependType());
return false;
}
}
return true;
}
/**
* construct process instance according to one command.
* @param command command
* @param host host
* @return process instance
*/
private ProcessInstance constructProcessInstance(Command command, String host){
ProcessInstance processInstance = null;
CommandType commandType = command.getCommandType();
Map<String, String> cmdParam = JSONUtils.toMap(command.getCommandParam());
ProcessDefinition processDefinition = null;
if(command.getProcessDefinitionId() != 0){
processDefinition = processDefineMapper.selectById(command.getProcessDefinitionId());
if(processDefinition == null){
logger.error("cannot find the work process define! define id : {}", command.getProcessDefinitionId());
return null;
}
}
if(cmdParam != null ){
Integer processInstanceId = 0; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if(cmdParam.containsKey(Constants.CMDPARAM_RECOVER_PROCESS_ID_STRING)) {
String processId = cmdParam.get(Constants.CMDPARAM_RECOVER_PROCESS_ID_STRING);
processInstanceId = Integer.parseInt(processId);
if (processInstanceId == 0) {
logger.error("command parameter is error, [ ProcessInstanceId ] is 0");
return null;
}
}else if(cmdParam.containsKey(Constants.CMDPARAM_SUB_PROCESS)){
String pId = cmdParam.get(Constants.CMDPARAM_SUB_PROCESS);
processInstanceId = Integer.parseInt(pId);
}else if(cmdParam.containsKey(Constants.CMDPARAM_RECOVERY_WAITTING_THREAD)){
String pId = cmdParam.get(Constants.CMDPARAM_RECOVERY_WAITTING_THREAD);
processInstanceId = Integer.parseInt(pId);
}
if(processInstanceId ==0){
processInstance = generateNewProcessInstance(processDefinition, command, cmdParam);
}else{
processInstance = this.findProcessInstanceDetailById(processInstanceId);
}
processDefinition = processDefineMapper.selectById(processInstance.getProcessDefinitionId());
processInstance.setProcessDefinition(processDefinition);
if(processInstance.getCommandParam() != null){
Map<String, String> processCmdParam = JSONUtils.toMap(processInstance.getCommandParam());
for(Map.Entry<String, String> entry: processCmdParam.entrySet()) {
if(!cmdParam.containsKey(entry.getKey())){
cmdParam.put(entry.getKey(), entry.getValue());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
}
if(cmdParam.containsKey(Constants.CMDPARAM_SUB_PROCESS)){
processInstance.setCommandParam(command.getCommandParam());
}
}else{
processInstance = generateNewProcessInstance(processDefinition, command, cmdParam);
}
if(!checkCmdParam(command, cmdParam)){
logger.error("command parameter check failed!");
return null;
}
if(command.getScheduleTime() != null){
processInstance.setScheduleTime(command.getScheduleTime());
}
processInstance.setHost(host);
ExecutionStatus runStatus = ExecutionStatus.RUNNING_EXEUTION;
int runTime = processInstance.getRunTimes();
switch (commandType){
case START_PROCESS:
break;
case START_FAILURE_TASK_PROCESS:
List<Integer> failedList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.FAILURE);
List<Integer> toleranceList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.NEED_FAULT_TOLERANCE);
List<Integer> killedList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.KILL);
cmdParam.remove(Constants.CMDPARAM_RECOVERY_START_NODE_STRING);
failedList.addAll(killedList); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | failedList.addAll(toleranceList);
for(Integer taskId : failedList){
initTaskInstance(this.findTaskInstanceById(taskId));
}
cmdParam.put(Constants.CMDPARAM_RECOVERY_START_NODE_STRING,
String.join(Constants.COMMA, convertIntListToString(failedList)));
processInstance.setCommandParam(JSONUtils.toJson(cmdParam));
processInstance.setRunTimes(runTime +1 );
break;
case START_CURRENT_TASK_PROCESS:
break;
case RECOVER_WAITTING_THREAD:
break;
case RECOVER_SUSPENDED_PROCESS:
cmdParam.remove(Constants.CMDPARAM_RECOVERY_START_NODE_STRING);
List<Integer> suspendedNodeList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.PAUSE);
List<Integer> stopNodeList = findTaskIdByInstanceState(processInstance.getId(),
ExecutionStatus.KILL);
suspendedNodeList.addAll(stopNodeList);
for(Integer taskId : suspendedNodeList){
initTaskInstance(this.findTaskInstanceById(taskId));
}
cmdParam.put(Constants.CMDPARAM_RECOVERY_START_NODE_STRING, String.join(",", convertIntListToString(suspendedNodeList)));
processInstance.setCommandParam(JSONUtils.toJson(cmdParam));
processInstance.setRunTimes(runTime +1);
break;
case RECOVER_TOLERANCE_FAULT_PROCESS: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processInstance.setRecovery(Flag.YES);
runStatus = processInstance.getState();
break;
case COMPLEMENT_DATA:
List<TaskInstance> taskInstanceList = this.findValidTaskListByProcessId(processInstance.getId());
for(TaskInstance taskInstance : taskInstanceList){
taskInstance.setFlag(Flag.NO);
this.updateTaskInstance(taskInstance);
}
break;
case REPEAT_RUNNING:
if(cmdParam.containsKey(Constants.CMDPARAM_RECOVERY_START_NODE_STRING)){
cmdParam.remove(Constants.CMDPARAM_RECOVERY_START_NODE_STRING);
processInstance.setCommandParam(JSONUtils.toJson(cmdParam));
}
List<TaskInstance> validTaskList = findValidTaskListByProcessId(processInstance.getId());
for(TaskInstance taskInstance : validTaskList){
taskInstance.setFlag(Flag.NO);
updateTaskInstance(taskInstance);
}
processInstance.setStartTime(new Date());
processInstance.setEndTime(null);
processInstance.setRunTimes(runTime +1);
initComplementDataParam(processDefinition, processInstance, cmdParam);
break;
case SCHEDULER:
break; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | default:
break;
}
processInstance.setState(runStatus);
return processInstance;
}
/**
* return complement data if the process start with complement data
* @param processInstance processInstance
* @param command command
* @return command type
*/
private CommandType getCommandTypeIfComplement(ProcessInstance processInstance, Command command){
if(CommandType.COMPLEMENT_DATA == processInstance.getCmdTypeIfComplement()){
return CommandType.COMPLEMENT_DATA;
}else{
return command.getCommandType();
}
}
/**
* initialize complement data parameters
* @param processDefinition processDefinition
* @param processInstance processInstance
* @param cmdParam cmdParam
*/
private void initComplementDataParam(ProcessDefinition processDefinition,
ProcessInstance processInstance,
Map<String, String> cmdParam) {
if(!processInstance.isComplementData()){
return; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
Date startComplementTime = DateUtils.parse(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE),
YYYY_MM_DD_HH_MM_SS);
processInstance.setScheduleTime(startComplementTime);
processInstance.setGlobalParams(ParameterUtils.curingGlobalParams(
processDefinition.getGlobalParamMap(),
processDefinition.getGlobalParamList(),
CommandType.COMPLEMENT_DATA, processInstance.getScheduleTime()));
}
/**
* set sub work process parameters.
* handle sub work process instance, update relation table and command parameters
* set sub work process flag, extends parent work process command parameters
* @param subProcessInstance subProcessInstance
* @return process instance
*/
public ProcessInstance setSubProcessParam(ProcessInstance subProcessInstance){
String cmdParam = subProcessInstance.getCommandParam();
if(StringUtils.isEmpty(cmdParam)){
return subProcessInstance;
}
Map<String, String> paramMap = JSONUtils.toMap(cmdParam);
if(paramMap.containsKey(CMDPARAM_SUB_PROCESS)
&& CMDPARAM_EMPTY_SUB_PROCESS.equals(paramMap.get(CMDPARAM_SUB_PROCESS))){
paramMap.remove(CMDPARAM_SUB_PROCESS);
paramMap.put(CMDPARAM_SUB_PROCESS, String.valueOf(subProcessInstance.getId()));
subProcessInstance.setCommandParam(JSONUtils.toJson(paramMap));
subProcessInstance.setIsSubProcess(Flag.YES);
this.saveProcessInstance(subProcessInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
String parentInstanceId = paramMap.get(CMDPARAM_SUB_PROCESS_PARENT_INSTANCE_ID);
if(StringUtils.isNotEmpty(parentInstanceId)){
ProcessInstance parentInstance = findProcessInstanceDetailById(Integer.parseInt(parentInstanceId));
if(parentInstance != null){
subProcessInstance.setGlobalParams(
joinGlobalParams(parentInstance.getGlobalParams(), subProcessInstance.getGlobalParams()));
this.saveProcessInstance(subProcessInstance);
}else{
logger.error("sub process command params error, cannot find parent instance: {} ", cmdParam);
}
}
ProcessInstanceMap processInstanceMap = JSONUtils.parseObject(cmdParam, ProcessInstanceMap.class);
if(processInstanceMap == null || processInstanceMap.getParentProcessInstanceId() == 0){
return subProcessInstance;
}
processInstanceMap.setProcessInstanceId(subProcessInstance.getId());
this.updateWorkProcessInstanceMap(processInstanceMap);
return subProcessInstance;
}
/**
* join parent global params into sub process.
* only the keys doesn't in sub process global would be joined.
* @param parentGlobalParams parentGlobalParams
* @param subGlobalParams subGlobalParams
* @return global params join
*/
private String joinGlobalParams(String parentGlobalParams, String subGlobalParams){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | List<Property> parentPropertyList = JSONUtils.toList(parentGlobalParams, Property.class);
List<Property> subPropertyList = JSONUtils.toList(subGlobalParams, Property.class);
Map<String,String> subMap = subPropertyList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue));
for(Property parent : parentPropertyList){
if(!subMap.containsKey(parent.getProp())){
subPropertyList.add(parent);
}
}
return JSONUtils.toJson(subPropertyList);
}
/**
* initialize task instance
* @param taskInstance taskInstance
*/
private void initTaskInstance(TaskInstance taskInstance){
if(!taskInstance.isSubProcess()){
if(taskInstance.getState().typeIsCancel() || taskInstance.getState().typeIsFailure()){
taskInstance.setFlag(Flag.NO);
updateTaskInstance(taskInstance);
return;
}
}
taskInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS);
updateTaskInstance(taskInstance);
}
/**
* submit task to db
* submit sub process to command
* @param taskInstance taskInstance
* @param processInstance processInstance |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @return task instance
*/
@Transactional(rollbackFor = Exception.class)
public TaskInstance submitTask(TaskInstance taskInstance, ProcessInstance processInstance){
logger.info("start submit task : {}, instance id:{}, state: {}, ",
taskInstance.getName(), processInstance.getId(), processInstance.getState() );
processInstance = this.findProcessInstanceDetailById(processInstance.getId());
TaskInstance task = submitTaskInstanceToDB(taskInstance, processInstance);
if(task == null){
logger.error("end submit task to db error, task name:{}, process id:{} state: {} ",
taskInstance.getName(), taskInstance.getProcessInstance(), processInstance.getState());
return task;
}
if(!task.getState().typeIsFinished()){
createSubWorkProcessCommand(processInstance, task);
}
logger.info("end submit task to db successfully:{} state:{} complete, instance id:{} state: {} ",
taskInstance.getName(), task.getState(), processInstance.getId(), processInstance.getState());
return task;
}
/**
* set work process instance map
* @param parentInstance parentInstance
* @param parentTask parentTask
* @return process instance map
*/
private ProcessInstanceMap setProcessInstanceMap(ProcessInstance parentInstance, TaskInstance parentTask){
ProcessInstanceMap processMap = findWorkProcessMapByParent(parentInstance.getId(), parentTask.getId());
if(processMap != null){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return processMap;
}else if(parentInstance.getCommandType() == CommandType.REPEAT_RUNNING
|| parentInstance.isComplementData()){
processMap = findPreviousTaskProcessMap(parentInstance, parentTask);
if(processMap!= null){
processMap.setParentTaskInstanceId(parentTask.getId());
updateWorkProcessInstanceMap(processMap);
return processMap;
}
}
processMap = new ProcessInstanceMap();
processMap.setParentProcessInstanceId(parentInstance.getId());
processMap.setParentTaskInstanceId(parentTask.getId());
createWorkProcessInstanceMap(processMap);
return processMap;
}
/**
* find previous task work process map.
* @param parentProcessInstance parentProcessInstance
* @param parentTask parentTask
* @return process instance map
*/
private ProcessInstanceMap findPreviousTaskProcessMap(ProcessInstance parentProcessInstance,
TaskInstance parentTask) {
Integer preTaskId = 0;
List<TaskInstance> preTaskList = this.findPreviousTaskListByWorkProcessId(parentProcessInstance.getId());
for(TaskInstance task : preTaskList){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if(task.getName().equals(parentTask.getName())){
preTaskId = task.getId();
ProcessInstanceMap map = findWorkProcessMapByParent(parentProcessInstance.getId(), preTaskId);
if(map!=null){
return map;
}
}
}
logger.info("sub process instance is not found,parent task:{},parent instance:{}",
parentTask.getId(), parentProcessInstance.getId());
return null;
}
/**
* create sub work process command
* @param parentProcessInstance parentProcessInstance
* @param task task
*/
private void createSubWorkProcessCommand(ProcessInstance parentProcessInstance,
TaskInstance task){
if(!task.isSubProcess()){
return;
}
ProcessInstanceMap instanceMap = setProcessInstanceMap(parentProcessInstance, task);
TaskNode taskNode = JSONUtils.parseObject(task.getTaskJson(), TaskNode.class);
Map<String, String> subProcessParam = JSONUtils.toMap(taskNode.getParams());
Integer childDefineId = Integer.parseInt(subProcessParam.get(Constants.CMDPARAM_SUB_PROCESS_DEFINE_ID));
ProcessInstance childInstance = findSubProcessInstance(parentProcessInstance.getId(), task.getId());
CommandType fatherType = parentProcessInstance.getCommandType();
CommandType commandType = fatherType;
if(childInstance == null || commandType == CommandType.REPEAT_RUNNING){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | String fatherHistoryCommand = parentProcessInstance.getHistoryCmd();
if(fatherHistoryCommand.startsWith(CommandType.SCHEDULER.toString()) ||
fatherHistoryCommand.startsWith(CommandType.COMPLEMENT_DATA.toString())){
commandType = CommandType.valueOf(fatherHistoryCommand.split(Constants.COMMA)[0]);
}
}
if(childInstance != null){
childInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS);
updateProcessInstance(childInstance);
}
String processMapStr = JSONUtils.toJson(instanceMap);
Map<String, String> cmdParam = JSONUtils.toMap(processMapStr);
if(commandType == CommandType.COMPLEMENT_DATA ||
(childInstance != null && childInstance.isComplementData())){
Map<String, String> parentParam = JSONUtils.toMap(parentProcessInstance.getCommandParam());
String endTime = parentParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE);
String startTime = parentParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE);
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, endTime);
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, startTime);
processMapStr = JSONUtils.toJson(cmdParam);
}
updateSubProcessDefinitionByParent(parentProcessInstance, childDefineId);
Command command = new Command();
command.setWarningType(parentProcessInstance.getWarningType());
command.setWarningGroupId(parentProcessInstance.getWarningGroupId());
command.setFailureStrategy(parentProcessInstance.getFailureStrategy());
command.setProcessDefinitionId(childDefineId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | command.setScheduleTime(parentProcessInstance.getScheduleTime());
command.setExecutorId(parentProcessInstance.getExecutorId());
command.setCommandParam(processMapStr);
command.setCommandType(commandType);
command.setProcessInstancePriority(parentProcessInstance.getProcessInstancePriority());
createCommand(command);
logger.info("sub process command created: {} ", command.toString());
}
/**
* update sub process definition
* @param parentProcessInstance parentProcessInstance
* @param childDefinitionId childDefinitionId
*/
private void updateSubProcessDefinitionByParent(ProcessInstance parentProcessInstance, int childDefinitionId) {
ProcessDefinition fatherDefinition = this.findProcessDefineById(parentProcessInstance.getProcessDefinitionId());
ProcessDefinition childDefinition = this.findProcessDefineById(childDefinitionId);
if(childDefinition != null && fatherDefinition != null){
childDefinition.setReceivers(fatherDefinition.getReceivers());
childDefinition.setReceiversCc(fatherDefinition.getReceiversCc());
processDefineMapper.updateById(childDefinition);
}
}
/**
* submit task to mysql
* @param taskInstance taskInstance
* @param processInstance processInstance
* @return task instance
*/
public TaskInstance submitTaskInstanceToDB(TaskInstance taskInstance, ProcessInstance processInstance){
ExecutionStatus processInstanceState = processInstance.getState(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if(taskInstance.getState().typeIsFailure()){
if(taskInstance.isSubProcess()){
taskInstance.setRetryTimes(taskInstance.getRetryTimes() + 1 );
}else {
if( processInstanceState != ExecutionStatus.READY_STOP
&& processInstanceState != ExecutionStatus.READY_PAUSE){
taskInstance.setFlag(Flag.NO);
updateTaskInstance(taskInstance);
if(taskInstance.getState() != ExecutionStatus.NEED_FAULT_TOLERANCE){
taskInstance.setRetryTimes(taskInstance.getRetryTimes() + 1 );
}
taskInstance.setEndTime(null);
taskInstance.setStartTime(new Date());
taskInstance.setFlag(Flag.YES);
taskInstance.setHost(null);
taskInstance.setId(0);
}
}
}
taskInstance.setExecutorId(processInstance.getExecutorId());
taskInstance.setProcessInstancePriority(processInstance.getProcessInstancePriority());
taskInstance.setState(getSubmitTaskState(taskInstance, processInstanceState));
taskInstance.setSubmitTime(new Date());
boolean saveResult = saveTaskInstance(taskInstance);
if(!saveResult){
return null;
}
return taskInstance; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* submit task to queue
* @param taskInstance taskInstance
* @return whether submit task to queue success
*/
public Boolean submitTaskToQueue(TaskInstance taskInstance) {
try{
if(taskInstance.isSubProcess()){
return true;
}
if(taskInstance.getState().typeIsFinished()){
logger.info("submit to task queue, but task [{}] state [{}] is already finished. ", taskInstance.getName(), taskInstance.getState());
return true;
}
if(taskInstance.getState() == ExecutionStatus.RUNNING_EXEUTION){
logger.info("submit to task queue, but task [{}] state already be running. ", taskInstance.getName());
return true;
}
if(checkTaskExistsInTaskQueue(taskInstance)){
logger.info("submit to task queue, but task [{}] already exists in the queue.", taskInstance.getName());
return true;
}
logger.info("task ready to queue: {}" , taskInstance);
boolean insertQueueResult = taskQueue.add(DOLPHINSCHEDULER_TASKS_QUEUE, taskZkInfo(taskInstance));
logger.info("master insert into queue success, task : {}", taskInstance.getName());
return insertQueueResult;
}catch (Exception e){
logger.error("submit task to queue Exception: ", e); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | logger.error("task queue error : {}", JSONUtils.toJson(taskInstance));
return false;
}
}
/**
* ${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskInstanceId}_${task executed by ip1},${ip2}...
* The tasks with the highest priority are selected by comparing the priorities of the above four levels from high to low.
* @param taskInstance taskInstance
* @return task zk queue str
*/
public String taskZkInfo(TaskInstance taskInstance) {
int taskWorkerGroupId = getTaskWorkerGroupId(taskInstance);
ProcessInstance processInstance = this.findProcessInstanceById(taskInstance.getProcessInstanceId());
if(processInstance == null){
logger.error("process instance is null. please check the task info, task id: " + taskInstance.getId());
return "";
}
StringBuilder sb = new StringBuilder(100);
sb.append(processInstance.getProcessInstancePriority().ordinal()).append(Constants.UNDERLINE)
.append(taskInstance.getProcessInstanceId()).append(Constants.UNDERLINE)
.append(taskInstance.getTaskInstancePriority().ordinal()).append(Constants.UNDERLINE)
.append(taskInstance.getId()).append(Constants.UNDERLINE);
if(taskWorkerGroupId > 0){
WorkerGroup workerGroup = queryWorkerGroupById(taskWorkerGroupId);
if(workerGroup == null ){
logger.info("task {} cannot find the worker group, use all worker instead.", taskInstance.getId());
sb.append(Constants.DEFAULT_WORKER_ID);
return sb.toString();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | String ips = workerGroup.getIpList();
if(StringUtils.isBlank(ips)){
logger.error("task:{} worker group:{} parameters(ip_list) is null, this task would be running on all workers",
taskInstance.getId(), workerGroup.getId());
sb.append(Constants.DEFAULT_WORKER_ID);
return sb.toString();
}
StringBuilder ipSb = new StringBuilder(100);
String[] ipArray = ips.split(COMMA);
for (String ip : ipArray) {
long ipLong = IpUtils.ipToLong(ip);
ipSb.append(ipLong).append(COMMA);
}
if(ipSb.length() > 0) {
ipSb.deleteCharAt(ipSb.length() - 1);
}
sb.append(ipSb);
}else{
sb.append(Constants.DEFAULT_WORKER_ID);
}
return sb.toString();
}
/**
* get submit task instance state by the work process state
* cannot modify the task state when running/kill/submit success, or this
* task instance is already exists in task queue .
* return pause if work process state is ready pause
* return stop if work process state is ready stop
* if all of above are not satisfied, return submit success
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param taskInstance taskInstance
* @param processInstanceState processInstanceState
* @return process instance state
*/
public ExecutionStatus getSubmitTaskState(TaskInstance taskInstance, ExecutionStatus processInstanceState){
ExecutionStatus state = taskInstance.getState();
if(
state == ExecutionStatus.RUNNING_EXEUTION
|| state == ExecutionStatus.KILL
|| checkTaskExistsInTaskQueue(taskInstance)
){
return state;
}
if( processInstanceState == ExecutionStatus.READY_PAUSE){
state = ExecutionStatus.PAUSE;
}else if(processInstanceState == ExecutionStatus.READY_STOP
|| !checkProcessStrategy(taskInstance)) {
state = ExecutionStatus.KILL;
}else{
state = ExecutionStatus.SUBMITTED_SUCCESS;
}
return state;
}
/**
* check process instance strategy |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param taskInstance taskInstance
* @return check strategy result
*/
private boolean checkProcessStrategy(TaskInstance taskInstance){
ProcessInstance processInstance = this.findProcessInstanceById(taskInstance.getProcessInstanceId());
FailureStrategy failureStrategy = processInstance.getFailureStrategy();
if(failureStrategy == FailureStrategy.CONTINUE){
return true;
}
List<TaskInstance> taskInstances = this.findValidTaskListByProcessId(taskInstance.getProcessInstanceId());
for(TaskInstance task : taskInstances){
if(task.getState() == ExecutionStatus.FAILURE){
return false;
}
}
return true;
}
/**
* check the task instance existing in queue
* @param taskInstance taskInstance
* @return whether taskinstance exists queue
*/
public boolean checkTaskExistsInTaskQueue(TaskInstance taskInstance){
if(taskInstance.isSubProcess()){
return false;
}
String taskZkInfo = taskZkInfo(taskInstance);
return taskQueue.checkTaskExists(DOLPHINSCHEDULER_TASKS_QUEUE, taskZkInfo);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * create a new process instance
* @param processInstance processInstance
*/
public void createProcessInstance(ProcessInstance processInstance){
if (processInstance != null){
processInstanceMapper.insert(processInstance);
}
}
/**
* insert or update work process instance to data base
* @param processInstance processInstance
*/
public void saveProcessInstance(ProcessInstance processInstance){
if (processInstance == null){
logger.error("save error, process instance is null!");
return ;
}
if(processInstance.getId() != 0){
processInstanceMapper.updateById(processInstance);
}else{
createProcessInstance(processInstance);
}
}
/**
* insert or update command
* @param command command
* @return save command result
*/
public int saveCommand(Command command){
if(command.getId() != 0){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return commandMapper.updateById(command);
}else{
return commandMapper.insert(command);
}
}
/**
* insert or update task instance
* @param taskInstance taskInstance
* @return save task instance result
*/
public boolean saveTaskInstance(TaskInstance taskInstance){
if(taskInstance.getId() != 0){
return updateTaskInstance(taskInstance);
}else{
return createTaskInstance(taskInstance);
}
}
/**
* insert task instance
* @param taskInstance taskInstance
* @return create task instance result
*/
public boolean createTaskInstance(TaskInstance taskInstance) {
int count = taskInstanceMapper.insert(taskInstance);
return count > 0;
}
/**
* update task instance
* @param taskInstance taskInstance
* @return update task instance result |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
public boolean updateTaskInstance(TaskInstance taskInstance){
int count = taskInstanceMapper.updateById(taskInstance);
return count > 0;
}
/**
* delete a command by id
* @param id id
*/
public void delCommandByid(int id) {
commandMapper.deleteById(id);
}
/**
* find task instance by id
* @param taskId task id
* @return task intance
*/
public TaskInstance findTaskInstanceById(Integer taskId){
return taskInstanceMapper.selectById(taskId);
}
/**
* package task instance,associate processInstance and processDefine
* @param taskInstId taskInstId
* @return task instance
*/
public TaskInstance getTaskInstanceDetailByTaskId(int taskInstId){
//
TaskInstance taskInstance = findTaskInstanceById(taskInstId);
if(taskInstance == null){
return taskInstance; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
//
ProcessInstance processInstance = findProcessInstanceDetailById(taskInstance.getProcessInstanceId());
//
ProcessDefinition processDefine = findProcessDefineById(taskInstance.getProcessDefinitionId());
taskInstance.setProcessInstance(processInstance);
taskInstance.setProcessDefine(processDefine);
return taskInstance;
}
/**
* get id list by task state
* @param instanceId instanceId
* @param state state
* @return task instance states
*/
public List<Integer> findTaskIdByInstanceState(int instanceId, ExecutionStatus state){
return taskInstanceMapper.queryTaskByProcessIdAndState(instanceId, state.ordinal());
}
/**
* find valid task list by process definition id
* @param processInstanceId processInstanceId
* @return task instance list
*/
public List<TaskInstance> findValidTaskListByProcessId(Integer processInstanceId){
return taskInstanceMapper.findValidTaskListByProcessId(processInstanceId, Flag.YES);
}
/**
* find previous task list by work process id
* @param processInstanceId processInstanceId
* @return task instance list |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
public List<TaskInstance> findPreviousTaskListByWorkProcessId(Integer processInstanceId){
return taskInstanceMapper.findValidTaskListByProcessId(processInstanceId, Flag.NO);
}
/**
* update work process instance map
* @param processInstanceMap processInstanceMap
* @return update process instance result
*/
public int updateWorkProcessInstanceMap(ProcessInstanceMap processInstanceMap){
return processInstanceMapMapper.updateById(processInstanceMap);
}
/**
* create work process instance map
* @param processInstanceMap processInstanceMap
* @return create process instance result
*/
public int createWorkProcessInstanceMap(ProcessInstanceMap processInstanceMap){
Integer count = 0;
if(processInstanceMap !=null){
return processInstanceMapMapper.insert(processInstanceMap);
}
return count;
}
/**
* find work process map by parent process id and parent task id.
* @param parentWorkProcessId parentWorkProcessId
* @param parentTaskId parentTaskId
* @return process instance map
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | public ProcessInstanceMap findWorkProcessMapByParent(Integer parentWorkProcessId, Integer parentTaskId){
return processInstanceMapMapper.queryByParentId(parentWorkProcessId, parentTaskId);
}
/**
* delete work process map by parent process id
* @param parentWorkProcessId parentWorkProcessId
* @return delete process map result
*/
public int deleteWorkProcessMapByParentId(int parentWorkProcessId){
return processInstanceMapMapper.deleteByParentProcessId(parentWorkProcessId);
}
/**
* find sub process instance
* @param parentProcessId parentProcessId
* @param parentTaskId parentTaskId
* @return process instance
*/
public ProcessInstance findSubProcessInstance(Integer parentProcessId, Integer parentTaskId){
ProcessInstance processInstance = null;
ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryByParentId(parentProcessId, parentTaskId);
if(processInstanceMap == null || processInstanceMap.getProcessInstanceId() == 0){
return processInstance;
}
processInstance = findProcessInstanceById(processInstanceMap.getProcessInstanceId());
return processInstance;
}
/**
* find parent process instance
* @param subProcessId subProcessId
* @return process instance |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
public ProcessInstance findParentProcessInstance(Integer subProcessId) {
ProcessInstance processInstance = null;
ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryBySubProcessId(subProcessId);
if(processInstanceMap == null || processInstanceMap.getProcessInstanceId() == 0){
return processInstance;
}
processInstance = findProcessInstanceById(processInstanceMap.getParentProcessInstanceId());
return processInstance;
}
/**
* change task state
* @param state state
* @param startTime startTime
* @param host host
* @param executePath executePath
* @param logPath logPath
* @param taskInstId taskInstId
*/
public void changeTaskState(ExecutionStatus state, Date startTime, String host,
String executePath,
String logPath,
int taskInstId) {
TaskInstance taskInstance = taskInstanceMapper.selectById(taskInstId);
taskInstance.setState(state);
taskInstance.setStartTime(startTime);
taskInstance.setHost(host);
taskInstance.setExecutePath(executePath);
taskInstance.setLogPath(logPath);
saveTaskInstance(taskInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* update process instance
* @param processInstance processInstance
* @return update process instance result
*/
public int updateProcessInstance(ProcessInstance processInstance){
return processInstanceMapper.updateById(processInstance);
}
/**
* update the process instance
* @param processInstanceId processInstanceId
* @param processJson processJson
* @param globalParams globalParams
* @param scheduleTime scheduleTime
* @param flag flag
* @param locations locations
* @param connects connects
* @return update process instance result
*/
public int updateProcessInstance(Integer processInstanceId, String processJson,
String globalParams, Date scheduleTime, Flag flag,
String locations, String connects){
ProcessInstance processInstance = processInstanceMapper.queryDetailById(processInstanceId);
if(processInstance!= null){
processInstance.setProcessInstanceJson(processJson);
processInstance.setGlobalParams(globalParams);
processInstance.setScheduleTime(scheduleTime);
processInstance.setLocations(locations);
processInstance.setConnects(connects); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return processInstanceMapper.updateById(processInstance);
}
return 0;
}
/**
* change task state
* @param state state
* @param endTime endTime
* @param taskInstId taskInstId
*/
public void changeTaskState(ExecutionStatus state,
Date endTime,
int taskInstId) {
TaskInstance taskInstance = taskInstanceMapper.selectById(taskInstId);
taskInstance.setState(state);
taskInstance.setEndTime(endTime);
saveTaskInstance(taskInstance);
}
/**
* convert integer list to string list
* @param intList intList
* @return string list
*/
public List<String> convertIntListToString(List<Integer> intList){
if(intList == null){
return new ArrayList<>();
}
List<String> result = new ArrayList<String>(intList.size());
for(Integer intVar : intList){
result.add(String.valueOf(intVar)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,282 | this workflow is bug , I think it's a very serious problem | Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild | https://github.com/apache/dolphinscheduler/issues/2282 | https://github.com/apache/dolphinscheduler/pull/2329 | 949b8ef17d2b734b239ce31c997d7084868347b7 | 69e000b54214e8331ede69bdce9710b8418e960e | 2020-03-23T08:00:51Z | java | 2020-04-02T16:16:01Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
return result;
}
/**
* update pid and app links field by task instance id
* @param taskInstId taskInstId
* @param pid pid
* @param appLinks appLinks
*/
public void updatePidByTaskInstId(int taskInstId, int pid,String appLinks) {
TaskInstance taskInstance = taskInstanceMapper.selectById(taskInstId);
taskInstance.setPid(pid);
taskInstance.setAppLink(appLinks);
saveTaskInstance(taskInstance);
}
/**
* query schedule by id
* @param id id
* @return schedule
*/
public Schedule querySchedule(int id) {
return scheduleMapper.selectById(id);
}
/**
* query Schedule by processDefinitionId
* @param processDefinitionId processDefinitionId
* @see Schedule
*/
public List<Schedule> queryReleaseSchedulerListByProcessDefinitionId(int processDefinitionId) {
return scheduleMapper.queryReleaseSchedulerListByProcessDefinitionId(processDefinitionId); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.