code
stringlengths 23
201k
| docstring
stringlengths 17
96.2k
| func_name
stringlengths 0
235
| language
stringclasses 1
value | repo
stringlengths 8
72
| path
stringlengths 11
317
| url
stringlengths 57
377
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
@Override
protected synchronized Class<?> loadClass(final String name, final boolean resolve)
throws ClassNotFoundException {
LOG.debug("Loading class: " + name + " for job " + this.jobId);
Class<?> c = findLoadedClass(name);
ClassNotFoundException ex = null;
// A Job instance is instantiated with an instance of Logger and Props loaded from the parent class
// in JobTypeManager. We must delegate loading of them both to the parent class as such.
if (c == null && !name.startsWith(LOG4J_CLASS_PREFIX) && !name.equals(Props.class.getName())
&& !name.startsWith(AZKABAN_SECURITY_CLASS)) {
// if this class has not been loaded before
try {
c = findClass(name);
if (c != null) {
LOG.debug("Loaded class: " + name + " " + " for job " + this.jobId);
}
} catch (final ClassNotFoundException e) {
LOG.debug(e.toString());
ex = e;
}
}
// try parent
if (c == null) {
c = this.parent.loadClass(name);
if (c != null) {
LOG.debug("Loaded class from parent: " + name + " for job " + this.jobId);
}
}
if (c == null) {
throw ex != null ? ex : new ClassNotFoundException(name);
}
if (resolve) {
// link the specified class as described in the "Execution" chapter of
// "The Java Language Specification"
resolveClass(c);
}
return c;
}
|
Try to load class from this classloader's URLs. Note that this is like servlet, not the
standard behaviour where we ask the parent to attempt to load first.
|
loadClass
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/JobClassLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/JobClassLoader.java
|
Apache-2.0
|
@VisibleForTesting
void addURL(Class clazz) {
super.addURL(clazz.getProtectionDomain().getCodeSource().getLocation());
}
|
Try to load class from this classloader's URLs. Note that this is like servlet, not the
standard behaviour where we ask the parent to attempt to load first.
|
addURL
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/JobClassLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/JobClassLoader.java
|
Apache-2.0
|
public static String[] partitionCommandLine(final String command) {
final ArrayList<String> commands = new ArrayList<>();
int index = 0;
StringBuffer buffer = new StringBuffer(command.length());
boolean isApos = false;
boolean isQuote = false;
while (index < command.length()) {
final char c = command.charAt(index);
switch (c) {
case ' ':
if (!isQuote && !isApos) {
final String arg = buffer.toString();
buffer = new StringBuffer(command.length() - index);
if (arg.length() > 0) {
commands.add(arg);
}
} else {
buffer.append(c);
}
break;
case '\'':
if (!isQuote) {
isApos = !isApos;
} else {
buffer.append(c);
}
break;
case '"':
if (!isApos) {
isQuote = !isQuote;
} else {
buffer.append(c);
}
break;
default:
buffer.append(c);
}
index++;
}
if (buffer.length() > 0) {
final String arg = buffer.toString();
commands.add(arg);
}
return commands.toArray(new String[commands.size()]);
}
|
Splits the command into a unix like command line structure. Quotes and single quotes are
treated as nested strings.
|
partitionCommandLine
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
@Override
public void run() throws Exception {
try {
resolveProps();
} catch (final Exception e) {
handleError("Bad property definition! " + e.getMessage(), e);
}
if (this.getSysProps().getBoolean(MEMCHECK_ENABLED, true)
&& this.getJobProps().getBoolean(AZKABAN_MEMORY_CHECK, true)) {
final Pair<Long, Long> memPair = getProcMemoryRequirement();
final long xms = memPair.getFirst();
final long xmx = memPair.getSecond();
// retry backoff in ms
final String oomMsg = String
.format("Cannot request memory (Xms %d kb, Xmx %d kb) from system for job %s",
xms, xmx, getId());
int attempt;
boolean isMemGranted = true;
//todo HappyRay: move to proper Guice after this class is refactored.
final SystemMemoryInfo memInfo = SERVICE_PROVIDER.getInstance(SystemMemoryInfo.class);
for (attempt = 1; attempt <= Constants.MEMORY_CHECK_RETRY_LIMIT; attempt++) {
isMemGranted = memInfo.canSystemGrantMemory(xmx);
if (isMemGranted) {
info(String.format("Memory granted for job %s", getId()));
if (attempt > 1) {
this.commonMetrics.decrementOOMJobWaitCount();
}
break;
}
if (attempt < Constants.MEMORY_CHECK_RETRY_LIMIT) {
info(String.format(oomMsg + ", sleep for %s secs and retry, attempt %s of %s",
TimeUnit.MILLISECONDS.toSeconds(
Constants.MEMORY_CHECK_INTERVAL_MS), attempt,
Constants.MEMORY_CHECK_RETRY_LIMIT));
if (attempt == 1) {
this.commonMetrics.incrementOOMJobWaitCount();
}
synchronized (this) {
try {
this.wait(Constants.MEMORY_CHECK_INTERVAL_MS);
} catch (final InterruptedException e) {
info(String
.format("Job %s interrupted while waiting for memory check retry", getId()));
}
}
if (this.killed) {
this.commonMetrics.decrementOOMJobWaitCount();
info(String.format("Job %s was killed while waiting for memory check retry", getId()));
return;
}
}
}
if (!isMemGranted) {
this.commonMetrics.decrementOOMJobWaitCount();
handleError(oomMsg, null);
}
}
List<String> commands = null;
try {
commands = getCommandList();
} catch (final Exception e) {
handleError("Job set up failed: " + e.getMessage(), e);
}
final long startMs = System.currentTimeMillis();
if (commands == null) {
handleError("There are no commands to execute", null);
}
info(commands.size() + " commands to execute.");
final File[] propFiles = initPropsFiles();
// change krb5ccname env var so that each job execution gets its own cache
final Map<String, String> envVars = getEnvironmentVariables();
envVars.put(KRB5CCNAME, getKrb5ccname(this.getJobProps()));
// determine whether to run as Azkaban or run as effectiveUser,
// by default, run as effectiveUser
String executeAsUserBinaryPath = null;
String effectiveUser = null;
final boolean isExecuteAsUser = this.getSysProps().getBoolean(EXECUTE_AS_USER, true);
//Get list of users we never execute flows as. (ie: root, azkaban)
final Set<String> blackListedUsers = new HashSet<>(
Arrays.asList(
this.getSysProps()
.getString(Constants.ConfigurationKeys.BLACK_LISTED_USERS, "root,azkaban")
.split(",")
)
);
// nativeLibFolder specifies the path for execute-as-user file,
// which will change user from Azkaban to effectiveUser
if (isExecuteAsUser) {
final String nativeLibFolder = this.getSysProps().getString(AZKABAN_SERVER_NATIVE_LIB_FOLDER);
executeAsUserBinaryPath = String.format("%s/%s", nativeLibFolder, "execute-as-user");
effectiveUser = getEffectiveUser(this.getJobProps());
// Throw exception if Azkaban tries to run flow as a prohibited user
if (blackListedUsers.contains(effectiveUser)) {
throw new RuntimeException(
String.format("Not permitted to proxy as '%s' through Azkaban", effectiveUser)
);
}
// Set parent directory permissions to <uid>:azkaban so user can write in their execution directory
// if the directory does not have correct permission already (should happen once per
// execution)
if (!canWriteInCurrentWorkingDirectory(effectiveUser)) {
info("Changing current working directory ownership");
assignUserFileOwnership(effectiveUser, getWorkingDirectory());
}
// Set property file permissions to <uid>:azkaban so user can write to their prop files
// in order to pass properties from one job to another, except the last one
for (int i = 0; i < 2; i++) {
info("Changing properties files ownership");
assignUserFileOwnership(effectiveUser, propFiles[i].getAbsolutePath());
}
}
for (String command : commands) {
AzkabanProcessBuilder builder = null;
if (isExecuteAsUser) {
command =
String.format("%s %s %s", executeAsUserBinaryPath, effectiveUser,
command);
info("Command: " + command);
builder =
new AzkabanProcessBuilder(partitionCommandLine(command))
.setEnv(envVars).setWorkingDir(getCwd()).setLogger(getLog())
.enableExecuteAsUser().setExecuteAsUserBinaryPath(executeAsUserBinaryPath)
.setEffectiveUser(effectiveUser);
} else {
info("Command: " + command);
builder =
new AzkabanProcessBuilder(partitionCommandLine(command))
.setEnv(envVars).setWorkingDir(getCwd()).setLogger(getLog());
}
if (builder.getEnv().size() > 0) {
info("Environment variables: " + builder.getEnv());
}
info("Working directory: " + builder.getWorkingDir());
// print out the Job properties to the job log.
this.logJobProperties();
synchronized (this) {
// Make sure that checking if the process job is killed and creating an AzkabanProcess
// object are atomic. The cancel method relies on this to make sure that if this.process is
// not null, this block of code which includes checking if the job is killed has not been
// executed yet.
if (this.killed) {
info("The job is killed. Abort. No job process created.");
return;
}
this.process = builder.build();
}
try {
this.process.run();
this.success = true;
} catch (final Throwable e) {
for (final File file : propFiles) {
if (file != null && file.exists()) {
file.delete();
}
}
throw new RuntimeException(e);
} finally {
info("Process with id " + this.process.getProcessId() + " completed "
+ (this.success ? "successfully" : "unsuccessfully") + " in "
+ ((System.currentTimeMillis() - startMs) / 1000) + " seconds.");
}
}
// Get the output properties from this job.
generateProperties(propFiles[1]);
}
|
Splits the command into a unix like command line structure. Quotes and single quotes are
treated as nested strings.
|
run
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
private String getKrb5ccname(final Props jobProps) {
final String effectiveUser = getEffectiveUser(jobProps);
final String projectName =
jobProps.getString(CommonJobProperties.PROJECT_NAME).replace(" ", "_");
final String flowId =
jobProps.getString(CommonJobProperties.FLOW_ID).replace(" ", "_");
final String jobId =
jobProps.getString(CommonJobProperties.JOB_ID).replace(" ", "_");
// execId should be an int and should not have space in it, ever
final String execId = jobProps.getString(CommonJobProperties.EXEC_ID);
final String krb5ccname =
String.format("/tmp/krb5cc__%s__%s__%s__%s__%s", projectName, flowId,
jobId, execId, effectiveUser);
return krb5ccname;
}
|
<pre>
This method extracts the kerberos ticket cache file name from the jobprops.
This method will ensure that each job execution will have its own kerberos ticket cache file
Given that the code only sets an environmental variable, the number of files created
corresponds
to the number of processes that are doing kinit in their flow, which should not be an
inordinately
high number.
</pre>
@return file name: the kerberos ticket cache file to use
|
getKrb5ccname
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
private boolean canWriteInCurrentWorkingDirectory(final String effectiveUser)
throws IOException {
final ExecuteAsUser executeAsUser = new ExecuteAsUser(
this.getSysProps().getString(AZKABAN_SERVER_NATIVE_LIB_FOLDER));
final Path tmpFilePath = Paths.get(getWorkingDirectory(), TEMP_FILE_NAME);
final List<String> checkIfUserCanWriteCommand = Arrays
.asList(CREATE_FILE, tmpFilePath.toString());
final int result = executeAsUser.execute(effectiveUser, checkIfUserCanWriteCommand);
// If TEMP_FILE user_can_write is created, it should be deleted at the end of the function
try {
Files.deleteIfExists(tmpFilePath);
} catch (Exception e) {
warn(String.format("Failed to delete %s in current working directory", TEMP_FILE_NAME), e);
}
return result == SUCCESSFUL_EXECUTION;
}
|
Checks to see if user has write access to current working directory which many users need for
their jobs to store temporary data/jars on the executor.
Accomplishes this by using execute-as-user to try to create an empty file in the cwd.
@param effectiveUser user/proxy user running the job
@return true if user has write permissions in current working directory otherwise false
|
canWriteInCurrentWorkingDirectory
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
private void assignUserFileOwnership(final String effectiveUser, final String fileName) throws
Exception {
final ExecuteAsUser executeAsUser = new ExecuteAsUser(
this.getSysProps().getString(AZKABAN_SERVER_NATIVE_LIB_FOLDER));
final String groupName = this.getSysProps().getString(AZKABAN_SERVER_GROUP_NAME, "azkaban");
final List<String> changeOwnershipCommand = Arrays
.asList(CHOWN, effectiveUser + ":" + groupName, fileName);
info("Change ownership of " + fileName + " to " + effectiveUser + ":" + groupName + ".");
final int result = executeAsUser.execute("root", changeOwnershipCommand);
if (result != 0) {
handleError("Failed to change current working directory ownership. Error code: " + Integer
.toString(result), null);
}
}
|
Changes permissions on file/directory so that the file/directory is owned by the user and the
group remains the azkaban service account name.
Leverages execute-as-user with "root" as the user to run the command.
@param effectiveUser user/proxy user running the job
@param fileName the name of the file whose permissions will be changed
|
assignUserFileOwnership
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
protected Pair<Long, Long> getProcMemoryRequirement() throws Exception {
return new Pair<>(0L, 0L);
}
|
This is used to get the min/max memory size requirement by processes. SystemMemoryInfo can use
the info to determine if the memory request can be fulfilled. For Java process, this should be
Xms/Xmx setting.
@return pair of min/max memory size
|
getProcMemoryRequirement
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
protected void handleError(final String errorMsg, final Exception e) throws Exception {
error(errorMsg);
if (e != null) {
throw new Exception(errorMsg, e);
} else {
throw new Exception(errorMsg);
}
}
|
This is used to get the min/max memory size requirement by processes. SystemMemoryInfo can use
the info to determine if the memory request can be fulfilled. For Java process, this should be
Xms/Xmx setting.
@return pair of min/max memory size
|
handleError
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
protected List<String> getCommandList() {
final List<String> commands = new ArrayList<>();
commands.add(this.getJobProps().getString(COMMAND));
for (int i = 1; this.getJobProps().containsKey(COMMAND + "." + i); i++) {
commands.add(this.getJobProps().getString(COMMAND + "." + i));
}
return commands;
}
|
This is used to get the min/max memory size requirement by processes. SystemMemoryInfo can use
the info to determine if the memory request can be fulfilled. For Java process, this should be
Xms/Xmx setting.
@return pair of min/max memory size
|
getCommandList
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
@Override
public void cancel() throws InterruptedException {
// in case the job is waiting
synchronized (this) {
this.killed = true;
this.notify();
if (this.process == null) {
// The job thread has not checked if the job is killed yet.
// setting the killed flag should be enough to abort the job.
// There is no job process to kill.
return;
}
}
this.process.awaitStartup();
final boolean processkilled = this.process
.softKill(KILL_TIME.toMillis(), TimeUnit.MILLISECONDS);
if (!processkilled) {
warn("Kill with signal TERM failed. Killing with KILL signal.");
this.process.hardKill();
}
}
|
This is used to get the min/max memory size requirement by processes. SystemMemoryInfo can use
the info to determine if the memory request can be fulfilled. For Java process, this should be
Xms/Xmx setting.
@return pair of min/max memory size
|
cancel
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
@Override
public double getProgress() {
return this.process != null && this.process.isComplete() ? 1.0 : 0.0;
}
|
This is used to get the min/max memory size requirement by processes. SystemMemoryInfo can use
the info to determine if the memory request can be fulfilled. For Java process, this should be
Xms/Xmx setting.
@return pair of min/max memory size
|
getProgress
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
public int getProcessId() {
return this.process.getProcessId();
}
|
This is used to get the min/max memory size requirement by processes. SystemMemoryInfo can use
the info to determine if the memory request can be fulfilled. For Java process, this should be
Xms/Xmx setting.
@return pair of min/max memory size
|
getProcessId
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
@VisibleForTesting
boolean isSuccess() {
return this.success;
}
|
This is used to get the min/max memory size requirement by processes. SystemMemoryInfo can use
the info to determine if the memory request can be fulfilled. For Java process, this should be
Xms/Xmx setting.
@return pair of min/max memory size
|
isSuccess
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
@VisibleForTesting
AzkabanProcess getProcess() {
return this.process;
}
|
This is used to get the min/max memory size requirement by processes. SystemMemoryInfo can use
the info to determine if the memory request can be fulfilled. For Java process, this should be
Xms/Xmx setting.
@return pair of min/max memory size
|
getProcess
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
public String getPath() {
return Utils.ifNull(this.getJobPath(), "");
}
|
This is used to get the min/max memory size requirement by processes. SystemMemoryInfo can use
the info to determine if the memory request can be fulfilled. For Java process, this should be
Xms/Xmx setting.
@return pair of min/max memory size
|
getPath
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
|
Apache-2.0
|
public void run() throws IOException {
if (this.isStarted() || this.isComplete()) {
throw new IllegalStateException("The process can only be used once.");
}
final ProcessBuilder builder = new ProcessBuilder(this.cmd);
builder.directory(new File(this.workingDir));
builder.environment().putAll(this.env);
builder.redirectErrorStream(true);
this.process = builder.start();
try {
this.processId = processId(this.process);
if (this.processId == 0) {
this.logger.info("Spawned process with unknown process id");
} else {
this.logger.info("Spawned process with id " + this.processId);
}
this.startupLatch.countDown();
final LogGobbler outputGobbler =
new LogGobbler(
new InputStreamReader(this.process.getInputStream(), StandardCharsets.UTF_8),
this.logger, Level.INFO, 30);
final LogGobbler errorGobbler =
new LogGobbler(
new InputStreamReader(this.process.getErrorStream(), StandardCharsets.UTF_8),
this.logger, Level.ERROR, 30);
outputGobbler.start();
errorGobbler.start();
int exitCode = -1;
try {
exitCode = this.process.waitFor();
} catch (final InterruptedException e) {
this.logger.info("Process interrupted. Exit code is " + exitCode, e);
}
this.completeLatch.countDown();
// try to wait for everything to get logged out before exiting
outputGobbler.awaitCompletion(5000);
errorGobbler.awaitCompletion(5000);
if (exitCode != 0) {
throw new ProcessFailureException(exitCode);
}
} finally {
IOUtils.closeQuietly(this.process.getInputStream());
IOUtils.closeQuietly(this.process.getOutputStream());
IOUtils.closeQuietly(this.process.getErrorStream());
}
}
|
Execute this process, blocking until it has completed.
|
run
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
public int getProcessId() {
checkStarted();
return this.processId;
}
|
Get the process id for this process, if it has started.
@return The process id or -1 if it cannot be fetched
|
getProcessId
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
public boolean softKill(final long time, final TimeUnit unit)
throws InterruptedException {
checkStarted();
if (this.processId != 0 && isStarted()) {
try {
if (this.isExecuteAsUser) {
final String cmd =
String.format("%s %s %s %d", this.executeAsUserBinary,
this.effectiveUser, KILL_COMMAND, this.processId);
Runtime.getRuntime().exec(cmd);
} else {
final String cmd = String.format("%s %d", KILL_COMMAND, this.processId);
Runtime.getRuntime().exec(cmd);
}
return this.completeLatch.await(time, unit);
} catch (final IOException e) {
this.logger.error("Kill attempt failed.", e);
}
return false;
}
return false;
}
|
Attempt to kill the process, waiting up to the given time for it to die
@param time The amount of time to wait
@param unit The time unit
@return true iff this soft kill kills the process in the given wait time.
|
softKill
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
private int processId(final java.lang.Process process) {
int processId = 0;
try {
final Field f = process.getClass().getDeclaredField("pid");
f.setAccessible(true);
processId = f.getInt(process);
} catch (final Throwable e) {
e.printStackTrace();
}
return processId;
}
|
Attempt to get the process id for this process
@param process The process to get the id from
@return The id of the process
|
processId
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
public boolean isStarted() {
return this.startupLatch.getCount() == 0L;
}
|
@return true iff the process has been started
|
isStarted
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
public boolean isComplete() {
return this.completeLatch.getCount() == 0L;
}
|
@return true iff the process has completed
|
isComplete
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
public boolean isRunning() {
return isStarted() && !isComplete();
}
|
@return true iff the process is currently running
|
isRunning
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
public void checkStarted() {
if (!isStarted()) {
throw new IllegalStateException("Process has not yet started.");
}
}
|
@return true iff the process is currently running
|
checkStarted
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
@Override
public String toString() {
return "Process(cmd = " + Joiner.on(" ").join(this.cmd) + ", env = " + this.env
+ ", cwd = " + this.workingDir + ")";
}
|
@return true iff the process is currently running
|
toString
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
public boolean isExecuteAsUser() {
return this.isExecuteAsUser;
}
|
@return true iff the process is currently running
|
isExecuteAsUser
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
public String getEffectiveUser() {
return this.effectiveUser;
}
|
@return true iff the process is currently running
|
getEffectiveUser
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java
|
Apache-2.0
|
private URL[] loadJobTypeClassLoaderURLs(final File pluginDir,
final String jobTypeName, final JobTypePluginSet plugins) {
// sysconf says what jars/confs to load
final List<URL> resources = new ArrayList<>();
final Props pluginLoadProps = plugins.getPluginLoaderProps(jobTypeName);
try {
// first global classpath
LOGGER.info("Adding global resources for " + jobTypeName);
final List<String> typeGlobalClassPath =
pluginLoadProps.getStringList("jobtype.global.classpath", null, ",");
if (typeGlobalClassPath != null) {
for (final String jar : typeGlobalClassPath) {
final URL cpItem = new File(jar).toURI().toURL();
if (!resources.contains(cpItem)) {
LOGGER.info("adding to classpath " + cpItem);
resources.add(cpItem);
}
}
}
// type specific classpath
LOGGER.info("Adding type resources.");
final List<String> typeClassPath =
pluginLoadProps.getStringList("jobtype.classpath", null, ",");
if (typeClassPath != null) {
for (final String jar : typeClassPath) {
final URL cpItem = new File(jar).toURI().toURL();
if (!resources.contains(cpItem)) {
LOGGER.info("adding to classpath " + cpItem);
resources.add(cpItem);
}
}
}
final List<String> jobtypeLibDirs =
pluginLoadProps.getStringList("jobtype.lib.dir", null, ",");
if (jobtypeLibDirs != null) {
for (final String libDir : jobtypeLibDirs) {
for (final File f : new File(libDir).listFiles()) {
if (f.getName().endsWith(".jar")) {
resources.add(f.toURI().toURL());
LOGGER.info("adding to classpath " + f.toURI().toURL());
}
}
}
}
LOGGER.info("Adding type override resources.");
for (final File f : pluginDir.listFiles()) {
if (f.getName().endsWith(".jar")) {
resources.add(f.toURI().toURL());
LOGGER.info("adding to classpath " + f.toURI().toURL());
}
}
} catch (final MalformedURLException e) {
throw new JobTypeManagerException(e);
}
// each job type can have a different class loader
LOGGER.info(String.format("Classpath for plugin[dir: %s, JobType: %s]: %s", pluginDir, jobTypeName,
resources));
return resources.toArray(new URL[resources.size()]);
}
|
Creates and loads all plugin resources (jars) into a ClassLoader
|
loadJobTypeClassLoaderURLs
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
@VisibleForTesting
public Job buildJobExecutor(final String jobId, Props jobProps, final Logger logger)
throws JobTypeManagerException {
final JobParams jobParams = createJobParams(jobId, jobProps, logger);
return createJob(jobId, jobParams, logger);
}
|
Creates and loads all plugin resources (jars) into a ClassLoader
|
buildJobExecutor
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
public JobParams createJobParams(final String jobId, Props jobProps, final Logger logger) {
// This is final because during build phase, you should never need to swap
// the pluginSet for safety reasons
final JobTypePluginSet pluginSet = getJobTypePluginSet();
try {
final Optional<String> jobTypeOptional = getJobType(jobProps);
if (!jobTypeOptional.isPresent()) {
throw new JobExecutionException(String.format(
"The 'type' parameter for job[%s] is missing or null or empty", jobProps));
}
final String jobType = jobTypeOptional.get();
logger.info("Building " + jobType + " job executor. ");
jobProps = getJobProps(jobProps, pluginSet, jobType);
final Props pluginLoadProps = getPluginLoadProps(pluginSet, jobType);
final List<URL> jobClassLoaderUrls = new ArrayList<>();
// collect jobtype declared dependencies for the job's classloader
final URL[] jobTypeURLs = pluginSet.getPluginClassLoaderURLs(jobType);
jobClassLoaderUrls.addAll(Arrays.asList(jobTypeURLs));
// collect cluster-specific dependencies for the job's classloader
Cluster targetCluster = null;
final Collection<String> components = getClusterComponents(jobProps,
pluginSet.getPluginLoaderProps(jobType), false);
ClassLoader jobContextClassLoader = this.parentLoader;
if (!components.isEmpty()) {
targetCluster = this.clusterRouter.getCluster(jobId, jobProps, logger,
components);
if (targetCluster != null && !Cluster.UNKNOWN.equals(targetCluster)) {
jobContextClassLoader = targetCluster.getSecurityManagerClassLoader();
jobProps.put(CommonJobProperties.TARGET_CLUSTER_ID, targetCluster.clusterId);
}
}
logger.info(String.format("JobClassLoader URLs: %s", jobClassLoaderUrls.stream()
.map(URL::toString).collect(Collectors.joining(", "))));
final ClassLoader jobClassLoader = new JobClassLoader(
jobClassLoaderUrls.toArray(new URL[jobClassLoaderUrls.size()]),
jobContextClassLoader, jobId);
// load the jobtype from JobClassLoader
final String jobTypeClassName = pluginSet.getPluginClassName(jobType);
final Class<? extends Object> jobTypeClass = jobClassLoader.loadClass(jobTypeClassName);
if (jobTypeClass == null) {
throw new JobExecutionException(String.format("Job type [%s] "
+ "is unrecognized. Could not construct job [%s] of type [%s].",
jobType, jobId, jobType));
}
// inject cluster jars and native libraries into jobs through properties
Props clusterSpecificProps = getClusterSpecificJobProps(targetCluster, jobProps, pluginLoadProps);
for (final String key : clusterSpecificProps.getKeySet()) {
// User's job props should take precedence over cluster props
if (!jobProps.containsKey(key)) {
jobProps.put(key, clusterSpecificProps.get(key));
}
}
// Override any plugin load props if specified.
// Make a clone of pluginLoadProps to ensure the original object is not corrupted.
// Use the cloned object from here on.
final Props pluginLoadPropsCopy = Props.clone(pluginLoadProps);
if (pluginLoadOverrideProps != null) {
final String[] propsList = pluginLoadOverrideProps.split(",");
for (final String prop : propsList) {
final String value = clusterSpecificProps.getString(prop, null);
if (value == null) {
// The property must be present in cluster specific props
logger.warn(String.format("Expected override property %s is not "
+ " present in ClusterSpecific Properties, ignoring it.", prop));
continue;
}
pluginLoadPropsCopy.put(prop, value);
}
}
Props nonOverriddableClusterProps = getClusterSpecificNonOverridableJobProps(clusterSpecificProps);
// CAUTION: ADD ROUTER-SPECIFIC PROPERTIES THAT ARE CRITICAL FOR JOB EXECUTION AS THE LAST
// STEP TO STOP THEM FROM BEING ACCIDENTALLY OVERRIDDEN BY JOB PROPERTIES
jobProps.putAll(nonOverriddableClusterProps);
jobProps = PropsUtils.resolveProps(jobProps);
Props pluginPrivateProps = pluginSet.getPluginPrivateProps(jobType);
if(pluginPrivateProps == null) { // some jobtypes (ie: noop) don't have private properties.
pluginPrivateProps = new Props();
}
return new JobParams(jobTypeClass, jobProps, pluginPrivateProps, pluginLoadPropsCopy,
jobContextClassLoader);
} catch (final Exception e) {
logger.error("Failed to build job executor for job " + jobId
+ e.getMessage());
throw new JobTypeManagerException("Failed to build job executor for job "
+ jobId, e);
} catch (final Throwable t) {
logger.error(
"Failed to build job executor for job " + jobId + t.getMessage(), t);
throw new JobTypeManagerException("Failed to build job executor for job "
+ jobId, t);
}
}
|
Create job parameters that can be used to create a job instance.
@param jobId job id
@param jobProps job properties
@param logger logger
@return job parameters that can be used to create a job instance
|
createJobParams
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
public static Optional<String> getJobType(Props jobProps) {
final String jobType = jobProps.getString("type", StringUtils.EMPTY);
return StringUtils.isNotBlank(jobType) ? Optional.of(jobType) : Optional.empty();
}
|
@param jobProps Properties for an Azkaban Job
@return The {@link Optional} jobType for the Azkaban Job.
|
getJobType
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
private static Props getClusterSpecificNonOverridableJobProps(final Props clusterSpecificJobProp) {
final Props props = new Props();
for (String prop : NON_OVERRIDABLE_PROPS) {
final String value = clusterSpecificJobProp.get(prop);
if (value != null) {
props.put(prop, value);
}
}
return props;
}
|
@param jobProps Properties for an Azkaban Job
@return The {@link Optional} jobType for the Azkaban Job.
|
getClusterSpecificNonOverridableJobProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
private static Props getJobProps(Props jobProps, JobTypePluginSet pluginSet, String jobType) {
Props pluginJobProps = pluginSet.getPluginJobProps(jobType);
// For default jobtypes, even though they don't have pluginJobProps configured,
// they still need to load properties from common.properties file if it's present
// because common.properties file is global to all jobtypes.
if (pluginJobProps == null) {
pluginJobProps = pluginSet.getCommonPluginJobProps();
}
if (pluginJobProps != null) {
for (final String k : pluginJobProps.getKeySet()) {
if (!jobProps.containsKey(k)) {
jobProps.put(k, pluginJobProps.get(k));
}
}
}
final JobPropsProcessor propsProcessor = pluginSet.getPluginJobPropsProcessor(jobType);
if (propsProcessor != null) {
jobProps = propsProcessor.process(jobProps);
}
return jobProps;
}
|
@param jobProps Properties for an Azkaban Job
@return The {@link Optional} jobType for the Azkaban Job.
|
getJobProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
static Props getPluginLoadProps(JobTypePluginSet pluginSet, String jobType) {
Props pluginLoadProps = pluginSet.getPluginLoaderProps(jobType);
if (pluginLoadProps != null) {
pluginLoadProps = PropsUtils.resolveProps(pluginLoadProps);
} else {
// pluginSet.getCommonPluginLoadProps() will return null if there is no plugins directory.
// hence assigning default Props() if that's the case
pluginLoadProps = pluginSet.getCommonPluginLoadProps();
if (pluginLoadProps == null) {
pluginLoadProps = new Props();
}
}
return pluginLoadProps;
}
|
@param jobProps Properties for an Azkaban Job
@return The {@link Optional} jobType for the Azkaban Job.
|
getPluginLoadProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
public static Job createJob(final String jobId, final JobParams jobParams, final Logger logger) {
try {
return
(Job) Utils.callConstructor(jobParams.jobClass, jobId, jobParams.pluginLoadProps,
jobParams.jobProps, jobParams.pluginPrivateProps, logger);
} catch (final Throwable e) {
final String message = "Ctor with private properties %s, will try one without. e = ";
if (e instanceof IllegalStateException && e.getCause() instanceof NoSuchMethodException) {
// expected, message quietly, don't confuse users
logger.debug(String.format(message, "not defined") + e.getMessage());
} else {
// unexpected, message loudly
logger.warn(String.format(message, "failed"), e);
}
}
try {
return
(Job) Utils.callConstructor(jobParams.jobClass, jobId, jobParams.pluginLoadProps,
jobParams.jobProps, logger);
} catch (final Throwable e) {
final String message = String.format("Failed to build job: %s", jobId);
logger.error(message, e);
throw new JobTypeManagerException(message, e);
}
}
|
Create an instance of Job with the given parameters, job id and job logger.
|
createJob
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
public synchronized JobTypePluginSet getJobTypePluginSet() {
return this.pluginSet;
}
|
Public for test reasons. Will need to move tests to the same package
|
getJobTypePluginSet
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
private Props getClusterSpecificJobProps(final Cluster cluster, final Props jobProps,
final Props pluginProps) {
final Props clusterProps = new Props();
Props sourceProps;
if (cluster != null && !Cluster.UNKNOWN.equals(cluster)){
sourceProps = cluster.getProperties();
clusterProps.putAll(sourceProps);
} else {
// fall back to the existing mechanism if no cluster is found/configured
sourceProps = pluginProps;
}
final Collection<String> components = getClusterComponents(jobProps, pluginProps, true);
final String javaLibPath = Cluster.getJavaLibraryPath(sourceProps, components);
if (javaLibPath != null && !javaLibPath.isEmpty()) {
clusterProps.put(CommonJobProperties.TARGET_CLUSTER_CLASSPATH, javaLibPath);
}
final String nativeLibPath = Cluster.getNativeLibraryPath(sourceProps, components);
if (nativeLibPath != null && !nativeLibPath.isEmpty()) {
clusterProps.put(CommonJobProperties.TARGET_CLUSTER_NATIVE_LIB, nativeLibPath);
}
final String hadoopSecurityManagerClass =
sourceProps.get(Cluster.HADOOP_SECURITY_MANAGER_CLASS_PROP);
if (hadoopSecurityManagerClass != null) {
clusterProps.put(
Cluster.HADOOP_SECURITY_MANAGER_CLASS_PROP, hadoopSecurityManagerClass);
}
return clusterProps;
}
|
Expose cluster-specific libraries and native libraries through job properties.
if a router is configured, construct the properties based on cluster.properties
otherwise, the cluster is implicitly configured, the properties will be based
on plugins' private properties.
|
getClusterSpecificJobProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
private static Collection<String> getClusterComponents(final Props jobProps,
final Props pluginProps, final boolean exclusionEnabled) {
// use ordered set to maintain the classpath order as much as possible
final Set<String> components = new LinkedHashSet<>();
if (jobProps != null) {
final List<String> jobTypeComponents = jobProps.getStringList(
CommonJobProperties.JOB_CLUSTER_COMPONENTS_DEPENDENCIES, Collections.emptyList(), ",");
components.addAll(jobTypeComponents);
}
if (pluginProps != null) {
final List<String> jobtypeComponents = pluginProps.getStringList(
CommonJobProperties.JOBTYPE_CLUSTER_COMPONENTS_DEPENDENCIES, Collections.emptyList(), ",");
components.addAll(jobtypeComponents);
}
if (exclusionEnabled && pluginProps != null) {
final List<String> excludedComponentsFromJobProcess = pluginProps.getStringList(
CommonJobProperties.JOBTYPE_CLUSTER_COMPONENTS_DEPENDENCIES_EXCLUDED, Collections.emptyList(), ",");
components.removeAll(excludedComponentsFromJobProcess);
}
return components;
}
|
Get the components within a cluster that a job depends on. Note if
jobtype.dependency.components.excluded is set to true, the libraries
of the specified components are not exposed to the JVM process that
a job may spawn. This is to address jar conflict between
HadoopSecurityManager dependencies (hive) and those of individual jobs
|
getClusterComponents
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypeManager.java
|
Apache-2.0
|
public Props getCommonPluginJobProps() {
return this.commonJobProps;
}
|
Gets common properties for every jobtype
|
getCommonPluginJobProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public void setCommonPluginJobProps(final Props commonJobProps) {
this.commonJobProps = commonJobProps;
}
|
Sets the common properties shared in every jobtype
|
setCommonPluginJobProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public Props getCommonPluginLoadProps() {
return this.commonLoadProps;
}
|
Gets the common properties used to load a plugin
|
getCommonPluginLoadProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public void setCommonPluginLoadProps(final Props commonLoadProps) {
this.commonLoadProps = commonLoadProps;
}
|
Sets the common properties used to load every plugin
|
setCommonPluginLoadProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public Props getPluginLoaderProps(final String jobTypeName) {
return this.pluginLoadPropsMap.get(jobTypeName);
}
|
Get the properties for a jobtype used to setup and load a plugin
|
getPluginLoaderProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public Props getPluginPrivateProps(final String jobTypeName) {
return this.pluginPrivatePropsMap.get(jobTypeName);
}
|
Get the plugin private properties for the jobtype
|
getPluginPrivateProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public Props getPluginJobProps(final String jobTypeName) {
return this.pluginJobPropsMap.get(jobTypeName);
}
|
Get the properties that will be given to the plugin as default job properties.
|
getPluginJobProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public void addPluginClassName(final String jobTypeName, final String jobTypeClassName) {
this.jobToClassName.put(jobTypeName, jobTypeClassName);
}
|
Get the properties that will be given to the plugin as default job properties.
|
addPluginClassName
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public String getPluginClassName(final String jobTypeName) {
return this.jobToClassName.get(jobTypeName);
}
|
Gets the plugin job class name
|
getPluginClassName
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public URL[] getPluginClassLoaderURLs(final String jobTypeName) {
return this.jobToClassLoaderURLs.getOrDefault(jobTypeName, EMPTY_URLS);
}
|
Get the resource URLs that should be added to its associated job ClassLoader.
|
getPluginClassLoaderURLs
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public void addPluginJobProps(final String jobTypeName, final Props props) {
this.pluginJobPropsMap.put(jobTypeName, props);
}
|
Adds plugin job properties used as default runtime properties
|
addPluginJobProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public void addPluginClassLoaderURLs(final String jobTypeName, final URL[] urls) {
this.jobToClassLoaderURLs.put(jobTypeName, urls);
}
|
Add resource URLs that should be made available to ClassLoader of all jobs of the given jobtype.
|
addPluginClassLoaderURLs
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public void addPluginLoadProps(final String jobTypeName, final Props props) {
this.pluginLoadPropsMap.put(jobTypeName, props);
}
|
Adds plugin load properties used to load the plugin
|
addPluginLoadProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public void addPluginPrivateProps(final String jobTypeName, final Props props) {
this.pluginPrivatePropsMap.put(jobTypeName, props);
}
|
Adds plugins private properties used by the plugin
|
addPluginPrivateProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public JobPropsProcessor getPluginJobPropsProcessor(
final String jobTypeName) {
return this.pluginJobPropsProcessor.get(jobTypeName);
}
|
Adds plugins private properties used by the plugin
|
getPluginJobPropsProcessor
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public void addPluginJobPropsProcessor(final String jobTypeName,
JobPropsProcessor jobPropsProcessor) {
this.pluginJobPropsProcessor.put(jobTypeName, jobPropsProcessor);
}
|
Adds plugins private properties used by the plugin
|
addPluginJobPropsProcessor
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public Set<String> getDefaultProxyUsersFilter() {
return this.defaultProxyUsersFilter;
}
|
@return The Set of users which are not allowed as defaultProxyUsers.
|
getDefaultProxyUsersFilter
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public Set<String> getDefaultProxyUsersJobTypeClasses() {
return this.defaultProxyUsersJobTypeClasses;
}
|
@return The list of allowed jobType classes for the defaultProxyUsers feature.
|
getDefaultProxyUsersJobTypeClasses
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public Optional<String> getDefaultProxyUser(String jobType) {
String defaultProxyUser = this.jobToDefaultProxyUser.get(jobType);
if (StringUtils.isBlank(defaultProxyUser)) {
return Optional.empty();
}
if (this.defaultProxyUsersFilter.contains(defaultProxyUser)) {
return Optional.empty();
}
if (!this.jobToClassName.containsKey(jobType)) {
return Optional.empty();
}
String jobTypeClassName = this.jobToClassName.get(jobType);
if (!this.defaultProxyUsersJobTypeClasses.contains(jobTypeClassName)) {
return Optional.empty();
}
return Optional.of(defaultProxyUser);
}
|
If the default proxy user is configured for the jobType and the jobType class associated is
part of allowed jobType classes for the defaultProxyUser feature, then return Optional
defaultProxyUser. Otherwise return Optional.empty().
@param jobType The type of the job like hadoopJava, hadoopShell, hive, java, etc.
@return {@link Optional} defaultProxyUser corresponding to the jobType.
|
getDefaultProxyUser
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
public void addDefaultProxyUser(String jobType, String defaultProxyUser) {
this.jobToDefaultProxyUser.put(jobType, defaultProxyUser);
}
|
Adds the defaultProxyUser for the jobType to the jobToDefaultProxyUser Map.
@param jobType The type of the job like hadoopJava, hadoopShell, hive, java, etc.
@param defaultProxyUser defaultProxyUser corresponding to the jobType.
|
addDefaultProxyUser
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/jobtype/JobTypePluginSet.java
|
Apache-2.0
|
@Override
public String getName() {
return this.name;
}
|
{@inheritDoc}
@see azkaban.metric.IMetric#getName()
|
getName
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
Apache-2.0
|
@Override
public String getValueType() {
return this.type;
}
|
{@inheritDoc}
@see azkaban.metric.IMetric#getValueType()
|
getValueType
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
Apache-2.0
|
@Override
public void updateMetricManager(final MetricReportManager manager) {
this.metricManager = manager;
}
|
{@inheritDoc}
@see azkaban.metric.IMetric#updateMetricManager(azkaban.metric.MetricReportManager)
|
updateMetricManager
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
Apache-2.0
|
@Override
public IMetric<T> getSnapshot() throws CloneNotSupportedException {
return (IMetric<T>) this.clone();
}
|
{@inheritDoc}
@see azkaban.metric.IMetric#getSnapshot()
|
getSnapshot
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
Apache-2.0
|
@Override
public T getValue() {
return this.value;
}
|
{@inheritDoc}
@see azkaban.metric.IMetric#getValue()
|
getValue
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
Apache-2.0
|
@Override
public void notifyManager() {
logger.debug(String.format("Notifying Manager for %s", this.getClass().getName()));
try {
this.metricManager.reportMetric(this);
} catch (final Throwable ex) {
logger.error(
String.format("Metric Manager is not set for %s metric", this.getClass().getName()), ex);
}
}
|
Method used to notify manager for a tracking event. Metric is free to call this method as per
implementation. Timer based or Azkaban events are the most common implementation {@inheritDoc}
@see azkaban.metric.IMetric#notifyManager()
|
notifyManager
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
|
Apache-2.0
|
public static boolean isAvailable() {
return isInstantiated() && isManagerEnabled;
}
|
@return true, if we have Instantiated and enabled metric manager from Azkaban exec server
|
isAvailable
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
Apache-2.0
|
public static boolean isInstantiated() {
return instance != null;
}
|
@return true, if we have Instantiated metric manager from Azkaban exec server
|
isInstantiated
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
Apache-2.0
|
public static MetricReportManager getInstance() {
if (instance == null) {
synchronized (MetricReportManager.class) {
if (instance == null) {
logger.info("Instantiating MetricReportManager");
instance = new MetricReportManager();
}
}
}
return instance;
}
|
Get a singleton object for Metric Manager
|
getInstance
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
Apache-2.0
|
@SuppressWarnings("FutureReturnValueIgnored")
public void reportMetric(final IMetric<?> metric) {
if (metric != null && isAvailable()) {
try {
final IMetric<?> metricSnapshot;
// take snapshot
synchronized (metric) {
metricSnapshot = metric.getSnapshot();
}
logger.debug(String
.format("Submitting %s metric for metric emission pool", metricSnapshot.getName()));
// report to all emitters
for (final IMetricEmitter metricEmitter : this.metricEmitters) {
this.executorService.submit(() -> {
try {
metricEmitter.reportMetric(metricSnapshot);
} catch (final Exception ex) {
logger.error(
String.format("Failed to report %s metric due to ", metricSnapshot.getName()),
ex);
}
});
}
} catch (final CloneNotSupportedException ex) {
logger.error(
String.format("Failed to take snapshot for %s metric", metric.getClass().getName()),
ex);
}
}
}
|
each element of metrics List is responsible to call this method and report metrics
@param metric
|
reportMetric
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
Apache-2.0
|
public void addMetric(final IMetric<?> metric) {
// metric null or already present
if (metric == null) {
throw new IllegalArgumentException("Cannot add a null metric");
}
if (getMetricFromName(metric.getName()) == null) {
logger.debug(String.format("Adding %s metric in Metric Manager", metric.getName()));
this.metrics.add(metric);
metric.updateMetricManager(this);
} else {
logger.error("Failed to add metric");
}
}
|
Add a metric to be managed by Metric Manager
|
addMetric
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
Apache-2.0
|
public IMetric<?> getMetricFromName(final String name) {
IMetric<?> metric = null;
if (name != null) {
for (final IMetric<?> currentMetric : this.metrics) {
if (currentMetric.getName().equals(name)) {
metric = currentMetric;
break;
}
}
}
return metric;
}
|
Get metric object for a given metric name
@param name metricName
@return metric Object, if found. Otherwise null.
|
getMetricFromName
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
Apache-2.0
|
@Override
protected void finalize() {
this.executorService.shutdown();
}
|
Shutdown execution service {@inheritDoc}
@see java.lang.Object#finalize()
|
finalize
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/MetricReportManager.java
|
Apache-2.0
|
private TimerTask getTimerTask() {
final TimeBasedReportingMetric<T> lockObject = this;
final TimerTask recurringReporting = new TimerTask() {
@Override
public void run() {
synchronized (lockObject) {
preTrackingEventMethod();
notifyManager();
postTrackingEventMethod();
}
}
};
return recurringReporting;
}
|
Get a TimerTask to reschedule Timer
@return An anonymous TimerTask class
|
getTimerTask
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/TimeBasedReportingMetric.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/TimeBasedReportingMetric.java
|
Apache-2.0
|
@Override
public void run() {
synchronized (lockObject) {
preTrackingEventMethod();
notifyManager();
postTrackingEventMethod();
}
}
|
Get a TimerTask to reschedule Timer
@return An anonymous TimerTask class
|
run
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/TimeBasedReportingMetric.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/TimeBasedReportingMetric.java
|
Apache-2.0
|
public Object getValue() {
return this.value;
}
|
Takes snapshot of the metric with a given value
|
getValue
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryNode.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryNode.java
|
Apache-2.0
|
public Date getTimestamp() {
return this.date;
}
|
Takes snapshot of the metric with a given value
|
getTimestamp
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryNode.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryNode.java
|
Apache-2.0
|
public synchronized void setReportingInterval(final long val) {
this.timeWindow = val;
}
|
Update reporting interval
@param val interval in milliseconds
|
setReportingInterval
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
Apache-2.0
|
public void setReportingInstances(final long num) {
this.numInstances = num;
}
|
Set number of /stats servlet display points
|
setReportingInstances
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
Apache-2.0
|
public List<InMemoryHistoryNode> getMetrics(final String metricName, final Date from,
final Date to,
final Boolean useStats) throws ClassCastException {
final LinkedList<InMemoryHistoryNode> selectedLists = new LinkedList<>();
if (this.historyListMapping.containsKey(metricName)) {
logger.debug("selecting snapshots within time frame");
synchronized (this.historyListMapping.get(metricName)) {
for (final InMemoryHistoryNode node : this.historyListMapping.get(metricName)) {
if (node.getTimestamp().after(from) && node.getTimestamp().before(to)) {
selectedLists.add(node);
}
if (node.getTimestamp().after(to)) {
break;
}
}
}
// selecting nodes if num of nodes > numInstances
if (useStats) {
statBasedSelectMetricHistory(selectedLists);
} else {
generalSelectMetricHistory(selectedLists);
}
}
cleanUsingTime(metricName, new Date());
return selectedLists;
}
|
Get snapshots for a given metric at a given time
@param metricName name of the metric
@param from Start date
@param to end date
@param useStats get statistically significant points only
@return List of snapshots
|
getMetrics
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
Apache-2.0
|
private void statBasedSelectMetricHistory(final LinkedList<InMemoryHistoryNode> selectedLists)
throws ClassCastException {
logger.debug("selecting snapshots which are far away from mean value");
final DescriptiveStatistics descStats = getDescriptiveStatistics(selectedLists);
final Double mean = descStats.getMean();
final Double std = descStats.getStandardDeviation();
final Iterator<InMemoryHistoryNode> ite = selectedLists.iterator();
while (ite.hasNext()) {
final InMemoryHistoryNode currentNode = ite.next();
final double value = ((Number) currentNode.getValue()).doubleValue();
// remove all elements which lies in 95% value band
if (value < mean + this.standardDeviationFactor * std
&& value > mean - this.standardDeviationFactor * std) {
ite.remove();
}
}
}
|
filter snapshots using statistically significant points only
@param selectedLists list of snapshots
|
statBasedSelectMetricHistory
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
Apache-2.0
|
private DescriptiveStatistics getDescriptiveStatistics(
final LinkedList<InMemoryHistoryNode> selectedLists)
throws ClassCastException {
final DescriptiveStatistics descStats = new DescriptiveStatistics();
for (final InMemoryHistoryNode node : selectedLists) {
descStats.addValue(((Number) node.getValue()).doubleValue());
}
return descStats;
}
|
filter snapshots using statistically significant points only
@param selectedLists list of snapshots
|
getDescriptiveStatistics
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
Apache-2.0
|
private void generalSelectMetricHistory(final LinkedList<InMemoryHistoryNode> selectedLists) {
logger.debug("selecting snapshots evenly from across the time interval");
if (selectedLists.size() > this.numInstances) {
final double step = (double) selectedLists.size() / this.numInstances;
long nextIndex = 0, currentIndex = 0, numSelectedInstances = 1;
final Iterator<InMemoryHistoryNode> ite = selectedLists.iterator();
while (ite.hasNext()) {
ite.next();
if (currentIndex == nextIndex) {
nextIndex = (long) Math.floor(numSelectedInstances * step + 0.5);
numSelectedInstances++;
} else {
ite.remove();
}
currentIndex++;
}
}
}
|
filter snapshots by evenly selecting points across the interval
@param selectedLists list of snapshots
|
generalSelectMetricHistory
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
Apache-2.0
|
private void cleanUsingTime(final String metricName, final Date firstAllowedDate) {
if (this.historyListMapping.containsKey(metricName)
&& this.historyListMapping.get(metricName) != null) {
synchronized (this.historyListMapping.get(metricName)) {
InMemoryHistoryNode firstNode = this.historyListMapping.get(metricName).peekFirst();
long localCopyOfTimeWindow = 0;
// go ahead for clean up using latest possible value of interval
// any interval change will not affect on going clean up
synchronized (this) {
localCopyOfTimeWindow = this.timeWindow;
}
// removing objects older than Interval time from firstAllowedDate
while (firstNode != null
&& TimeUnit.MILLISECONDS
.toMillis(firstAllowedDate.getTime() - firstNode.getTimestamp().getTime())
> localCopyOfTimeWindow) {
this.historyListMapping.get(metricName).removeFirst();
firstNode = this.historyListMapping.get(metricName).peekFirst();
}
}
}
}
|
Remove snapshots to maintain reporting interval
@param metricName Name of the metric
@param firstAllowedDate End date of the interval
|
cleanUsingTime
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
|
Apache-2.0
|
private void setupAllMetrics() {
this.flowFailMeter = this.metricsManager.addMeter(FLOW_FAIL_METER_NAME);
this.dispatchFailMeter = this.metricsManager.addMeter(DISPATCH_FAIL_METER_NAME);
this.dispatchSuccessMeter = this.metricsManager.addMeter(DISPATCH_SUCCESS_METER_NAME);
this.sendEmailFailMeter = this.metricsManager.addMeter(SEND_EMAIL_FAIL_METER_NAME);
this.sendEmailSuccessMeter = this.metricsManager.addMeter(SEND_EMAIL_SUCCESS_METER_NAME);
this.submitFlowSuccessMeter = this.metricsManager.addMeter(SUBMIT_FLOW_SUCCESS_METER_NAME);
this.submitFlowFailMeter = this.metricsManager.addMeter(SUBMIT_FLOW_FAIL_METER_NAME);
this.submitFlowSkipMeter = this.metricsManager.addMeter(SUBMIT_FLOW_SKIP_METER_NAME);
this.OOMWaitingJobCount = this.metricsManager.addCounter(OOM_WAITING_JOB_COUNT_NAME);
this.uploadFatProjectMeter = this.metricsManager.addMeter(UPLOAD_FAT_PROJECT_METER_NAME);
this.uploadThinProjectMeter = this.metricsManager.addMeter(UPLOAD_THIN_PROJECT_METER_NAME);
this.cancelFlowMeter = this.metricsManager.addMeter(CANCEL_FLOW_METER_NAME);
this.cancelFlowUnreachableMeter =
this.metricsManager.addMeter(CANCEL_FLOW_UNREACHABLE_METER_NAME);
this.cancelFlowUngracefulKillMeter =
this.metricsManager.addMeter(CANCEL_FLOW_UNGRACEFULLY_KILL_METER_NAME);
this.cancelFlowFailedMeter = this.metricsManager.addMeter(CANCEL_FLOW_FAILED_METER_NAME);
}
|
This singleton class CommonMetrics is in charge of collecting varieties of metrics which are
accessed in both web and exec modules. That said, these metrics will be exposed in both Web
server and executor.
|
setupAllMetrics
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/CommonMetrics.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/CommonMetrics.java
|
Apache-2.0
|
@Override
public void markPodCompleted() {
this.podCompleted.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markPodCompleted
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markPodRequested() {
this.podRequested.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markPodRequested
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markPodScheduled() {
this.podScheduled.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markPodScheduled
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markInitContainerRunning() {
this.initContainerRunning.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markInitContainerRunning
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markAppContainerStarting() {
this.appContainerStarting.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markAppContainerStarting
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markPodReady() {
this.podReady.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markPodReady
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markPodInitFailure() {
this.podInitFailure.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markPodInitFailure
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markPodAppFailure() {
this.podAppFailure.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markPodAppFailure
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void addTimeToDispatch(final long time) {
timeToDispatch.update(time);
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
addTimeToDispatch
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markFlowSubmitToExecutor() {
flowSubmitToExecutor.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markFlowSubmitToExecutor
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markFlowSubmitToContainer() {
flowSubmitToContainer.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markFlowSubmitToContainer
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markExecutionStopped() {
executionStopped.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markExecutionStopped
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markOOMKilled() {
oomKilled.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markOOMKilled
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markContainerDispatchFail() {
containerDispatchFail.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markContainerDispatchFail
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markVPARecommenderFail() {
vpaRecommenderFail.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markVPARecommenderFail
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markYarnGetApplicationsFail() {
yarnGetApplicationsFail.mark();
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markYarnGetApplicationsFail
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
@Override
public void markYarnApplicationKillFail(long n) {
yarnApplicationKillFail.mark(n);
}
|
Mark the occurrence of various pod statuses, defined by {@link azkaban.executor.container.watch.AzPodStatus}
|
markYarnApplicationKillFail
|
java
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/metrics/ContainerizationMetricsImpl.java
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.