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 |
|---|---|---|---|---|---|---|---|
private void configureJobLevelMetrics(final JobRunner jobRunner) {
this.logger.info("Configuring Azkaban metrics tracking for jobrunner object");
if (MetricReportManager.isAvailable()) {
final MetricReportManager metricManager = MetricReportManager.getInstance();
// Adding NumRunningJobMetric listener
jobRunner.addListener((NumRunningJobMetric) metricManager
.getMetricFromName(NumRunningJobMetric.NUM_RUNNING_JOB_METRIC_NAME));
// Adding NumFailedJobMetric listener
jobRunner.addListener((NumFailedJobMetric) metricManager
.getMetricFromName(NumFailedJobMetric.NUM_FAILED_JOB_METRIC_NAME));
}
jobRunner.addListener(JmxJobMBeanManager.getInstance());
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
configureJobLevelMetrics
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public void pause(final String user) throws IllegalStateException {
synchronized (this.mainSyncObj) {
this.logger.info("Execution pause requested by " + user);
if (!this.isKilled() && !this.flowFinished) {
this.flowPaused = true;
this.flow.setStatus(Status.PAUSED);
// Record the time the flow is paused
this.flowPauseTime = System.currentTimeMillis();
this.getExecutableFlow().setModifiedBy(user);
updateFlow();
this.logger.info("Execution " + this.execId + " has been paused.");
} else {
final String errorMessage = "Execution " + this.execId + " with status " +
this.flow.getStatus() + " cannot be paused.";
this.logger.warn(errorMessage);
throw new IllegalStateException(errorMessage);
}
}
interrupt();
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
pause
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public void resume(final String user) {
synchronized (this.mainSyncObj) {
if (!this.flowPaused) {
this.logger.info("Cannot resume flow that isn't paused");
} else {
this.logger.info("Flow resumed by " + user);
this.flowPaused = false;
if (this.flowFailed) {
this.flow.setStatus(Status.FAILED_FINISHING);
} else if (isKilled()) {
this.flow.setStatus(Status.KILLING);
this.execMetrics.incrementFlowKillingCount();
} else {
this.flow.setStatus(Status.RUNNING);
}
if (this.flowPauseTime != -1 && this.flowPauseDuration == 0) {
this.flowPauseDuration = System.currentTimeMillis() - this.flowPauseTime;
}
this.getExecutableFlow().setModifiedBy(user);
updateFlow();
}
}
interrupt();
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
resume
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public void kill(final String user) {
this.logger.info("Flow killed by " + user);
this.getExecutableFlow().setModifiedBy(user);
kill();
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
kill
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public void kill() {
synchronized (this.mainSyncObj) {
if (isKilled() || this.flowFinished) {
this.logger.info(
"Dropping Kill action as execution " + this.execId + " is already finished.");
return;
}
this.logger.info("Kill has been called on execution " + this.execId);
this.flow.setStatus(Status.KILLING);
this.execMetrics.incrementFlowKillingCount();
this.flowKillTime = System.currentTimeMillis();
// If the flow is paused, then we'll also unpause
this.flowPaused = false;
this.flowKilled = true;
if (this.watcher != null) {
this.logger.info("Watcher is attached. Stopping watcher.");
this.watcher.stopWatcher();
this.logger
.info("Watcher cancelled status is " + this.watcher.isWatchCancelled());
}
// Report FLOW_STATUS_CHANGED EVENT when status changes from running to killing
this.fireEventListeners(
Event.create(this, EventType.FLOW_STATUS_CHANGED,
new EventData(this.getExecutableFlow())));
this.logger.info("Killing " + this.activeJobRunners.size() + " jobs.");
for (final JobRunner runner : this.activeJobRunners) {
runner.getNode().setModifiedBy(this.getExecutableFlow().getModifiedBy());
runner.kill();
}
updateFlow();
}
interrupt();
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
kill
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public void retryFailures(final String user) {
synchronized (this.mainSyncObj) {
this.logger.info("Retrying failures invoked by " + user);
this.retryFailedJobs = true;
interrupt();
}
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
retryFailures
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
private void resetFailedState(final ExecutableFlowBase flow,
final List<ExecutableNode> nodesToRetry) {
// bottom up
final LinkedList<ExecutableNode> queue = new LinkedList<>();
for (final String id : flow.getEndNodes()) {
final ExecutableNode node = flow.getExecutableNode(id);
queue.add(node);
}
long maxStartTime = -1;
while (!queue.isEmpty()) {
final ExecutableNode node = queue.poll();
final Status initStatus = node.getStatus();
maxStartTime = Math.max(node.getStartTime(), maxStartTime);
final long currentTime = System.currentTimeMillis();
if (initStatus == Status.SUCCEEDED) {
// This is a candidate parent for restart
nodesToRetry.add(node);
continue;
} else if (initStatus == Status.RUNNING) {
continue;
} else if (initStatus == Status.KILLING) {
continue;
} else if (initStatus == Status.SKIPPED || initStatus == Status.DISABLED) {
node.setStatus(Status.DISABLED);
node.setEndTime(-1);
node.setStartTime(-1);
node.setUpdateTime(currentTime);
} else if (node instanceof ExecutableFlowBase) {
final ExecutableFlowBase base = (ExecutableFlowBase) node;
switch (base.getStatus()) {
case READY:
// Node hasn't run yet, continue analyzing its IN nodes
break;
case CANCELLED:
node.setStatus(Status.READY);
node.setEndTime(-1);
node.setStartTime(-1);
node.setUpdateTime(currentTime);
// Break out of the switch. We'll reset the flow just like a normal node.
break;
case KILLED:
case FAILED:
case FAILED_FINISHING:
resetFailedState(base, nodesToRetry);
continue;
default:
// Continue the while loop. If the job is in a finished state that's not a failure, we
// don't want to reset the job.
continue;
}
} else if (initStatus == Status.CANCELLED) {
// Not a flow, but killed
node.setStatus(Status.READY);
node.setStartTime(-1);
node.setEndTime(-1);
node.setUpdateTime(currentTime);
} else if (initStatus == Status.FAILED || initStatus == Status.KILLED) {
node.resetForRetry();
nodesToRetry.add(node);
}
if (!(node instanceof ExecutableFlowBase) && node.getStatus() != initStatus) {
this.logger.info("Resetting job '" + node.getNestedId() + "' from "
+ initStatus + " to " + node.getStatus());
}
for (final String inId : node.getInNodes()) {
final ExecutableNode nodeUp = flow.getExecutableNode(inId);
queue.add(nodeUp);
}
}
// At this point, the following code will reset the flow
final Status oldFlowState = flow.getStatus();
if (maxStartTime == -1) {
// Nothing has run inside the flow, so we assume the flow hasn't even started running yet.
flow.setStatus(Status.READY);
} else {
flow.setStatus(Status.RUNNING);
// Add any READY start nodes. Usually it means the flow started, but the
// start node has not.
for (final String id : flow.getStartNodes()) {
final ExecutableNode node = flow.getExecutableNode(id);
if (node.getStatus() == Status.READY || node.getStatus() == Status.DISABLED) {
nodesToRetry.add(node);
}
}
}
flow.setUpdateTime(System.currentTimeMillis());
flow.setEndTime(-1);
this.logger.info("Resetting flow '" + flow.getNestedId() + "' from " + oldFlowState + " to "
+ flow.getStatus());
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
resetFailedState
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
private void interrupt() {
if (this.flowRunnerThread != null) {
this.flowRunnerThread.interrupt();
}
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
interrupt
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public boolean isKilled() {
return this.flowKilled;
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
isKilled
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public boolean isRamping() {
return this.flowIsRamping;
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
isRamping
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public ExecutableFlow getExecutableFlow() {
return this.flow;
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
getExecutableFlow
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public File getFlowLogFile() {
return this.logFile;
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
getFlowLogFile
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public File getJobLogFile(final String jobId, final int attempt) {
final ExecutableNode node = this.flow.getExecutableNodePath(jobId);
final File path = new File(this.execDir, node.getJobSource());
final String logFileName = JobRunner.createLogFileName(node, attempt);
final File logFile = new File(path.getParentFile(), logFileName);
if (!logFile.exists()) {
return null;
}
return logFile;
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
getJobLogFile
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public File getJobAttachmentFile(final String jobId, final int attempt) {
final ExecutableNode node = this.flow.getExecutableNodePath(jobId);
final File path = new File(this.execDir, node.getJobSource());
final String attachmentFileName =
JobRunner.createAttachmentFileName(node, attempt);
final File attachmentFile = new File(path.getParentFile(), attachmentFileName);
if (!attachmentFile.exists()) {
return null;
}
return attachmentFile;
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
getJobAttachmentFile
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public File getJobMetaDataFile(final String jobId, final int attempt) {
final ExecutableNode node = this.flow.getExecutableNodePath(jobId);
final File path = new File(this.execDir, node.getJobSource());
final String metaDataFileName = JobRunner.createMetaDataFileName(node, attempt);
final File metaDataFile = new File(path.getParentFile(), metaDataFileName);
if (!metaDataFile.exists()) {
return null;
}
return metaDataFile;
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
getJobMetaDataFile
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
@VisibleForTesting
protected boolean isRunnerThreadShutdown() {
return this.flowRunnerThread != null && !this.flowRunnerThread.isAlive();
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
isRunnerThreadShutdown
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public int getExecutionId() {
return this.execId;
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
getExecutionId
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public Set<JobRunner> getActiveJobRunners() {
return ImmutableSet.copyOf(this.activeJobRunners);
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
getActiveJobRunners
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public FlowRunnerEventListener getFlowRunnerEventListener() {
return this.flowListener;
}
|
Configure Azkaban metrics tracking for a new jobRunner instance
|
getFlowRunnerEventListener
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public void setEffectiveUser(final String jobId, final String effectiveUser,
final Optional<String> jobType) {
if (StringUtils.isBlank(jobId)) {
logger.error("Job effective user can't be set as jobId string is blank.");
return;
}
if (StringUtils.isBlank(effectiveUser)) {
logger.error("Job effective user can't be set as effectiveUser string is blank.");
return;
}
final String previousVal;
if (!jobType.isPresent()) {
logger.error("Job effective user can't be set as jobType is absent.");
return;
}
// Currently noop is the only jobtype for ignoredJobEffectiveUsers, but in future there can
// be more.
if (jobType.get().equals("noop")) {
previousVal = FlowRunner.this.ignoredJobEffectiveUsers.put(jobId, effectiveUser);
} else {
previousVal = FlowRunner.this.jobEffectiveUsers.put(jobId, effectiveUser);
}
if (null != previousVal) {
logger.info(
String.format("Updated effectiveUser map for id: %s, prevVal: %s, newVal: %s", jobId,
previousVal, effectiveUser));
} else {
logger.info(String
.format("Updated effectiveUser map for id: %s, val: %s", jobId, effectiveUser));
}
}
|
@param jobId
@param effectiveUser
@param jobType
|
setEffectiveUser
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public void setCpuUtilization(final Double cpuUtilized) {
FlowRunner.this.cpuUtilized = Optional.ofNullable(cpuUtilized);
}
|
@param cpuUtilized measured in cpu Units. One cpu is equivalent to 1 vCPU/Core for
cloud providers and 1 hyperthread on bare-metal Intel processors. Fractional
values are allowed.
|
setCpuUtilization
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public void setMemoryUtilization(final Long memoryUtilizedInBytes) {
FlowRunner.this.memoryUtilizedInBytes = Optional.ofNullable(memoryUtilizedInBytes);
}
|
@param memoryUtilizedInBytes by the Azkaban flow.
|
setMemoryUtilization
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
@VisibleForTesting
synchronized Map<String, String> getFlowMetadata(final FlowRunner flowRunner,
final ExecutableFlowBase flow) {
final ExecutableFlow rootFlow = flowRunner.getExecutableFlow();
final Props props = ServiceProvider.SERVICE_PROVIDER.getInstance(Props.class);
final Map<String, String> metaData = new HashMap<>();
metaData.put(EventReporterConstants.FLOW_NAME, flow.getNestedId());
if (! (flow instanceof ExecutableFlow)) {
metaData.put(EventReporterConstants.IS_ROOT_FLOW, "false");
} else {
metaData.put(EventReporterConstants.IS_ROOT_FLOW, "true");
ExecutableFlow executableFlow = (ExecutableFlow) flow;
metaData.put(EventReporterConstants.SYSTEM_DEFINED_FLOW_RETRY_COUNT_PARAM,
String.valueOf(executableFlow.getSystemDefinedRetryCount()));
metaData.put(EventReporterConstants.USER_DEFINED_FLOW_RETRY_COUNT_PARAM,
String.valueOf(executableFlow.getUserDefinedRetryCount()));
metaData.put(EventReporterConstants.FLOW_RETRY_ROOT_EXECUTION_ID,
String.valueOf(executableFlow.getFlowRetryRootExecutionID()));
metaData.put(EventReporterConstants.FLOW_RETRY_PARENT_EXECUTION_ID,
String.valueOf(executableFlow.getFlowRetryParentExecutionID()));
metaData.put(EventReporterConstants.FLOW_RETRY_CHILD_EXECUTION_ID,
String.valueOf(executableFlow.getFlowRetryChildExecutionID()));
}
// Azkaban executor hostname
metaData.put(EventReporterConstants.AZ_HOST, props.getString(AZKABAN_SERVER_HOST_NAME,
"unknown"));
// As per web server construct, When AZKABAN_WEBSERVER_EXTERNAL_HOSTNAME is set use that,
// or else use jetty.hostname
metaData.put(EventReporterConstants.AZ_WEBSERVER,
props.getString(AZKABAN_WEBSERVER_EXTERNAL_HOSTNAME,
props.getString(JETTY_HOSTNAME, "localhost")));
metaData.put(EventReporterConstants.PROJECT_NAME, rootFlow.getProjectName());
metaData.put(EventReporterConstants.SUBMIT_USER, rootFlow.getSubmitUser());
metaData.put(EventReporterConstants.EXECUTION_ID, String.valueOf(rootFlow.getExecutionId()));
metaData.put(EventReporterConstants.START_TIME, String.valueOf(flow.getStartTime()));
metaData.put(EventReporterConstants.SUBMIT_TIME, String.valueOf(rootFlow.getSubmitTime()));
// Flow_Status_Changed event attributes: flowVersion, failedJobId, modifiedBy
metaData.put(EventReporterConstants.FLOW_VERSION,
String.valueOf(rootFlow.getAzkabanFlowVersion()));
metaData.put(EventReporterConstants.FAILED_JOB_ID, rootFlow.getFailedJobId());
metaData.put(EventReporterConstants.MODIFIED_BY, rootFlow.getModifiedBy());
// Flow_Status_Changed event elapsed time
metaData.put(EventReporterConstants.FLOW_KILL_DURATION,
String.valueOf(flowRunner.getFlowKillDuration()));
metaData.put(EventReporterConstants.FLOW_PAUSE_DURATION,
String.valueOf(flowRunner.getFlowPauseDuration()));
metaData.put(EventReporterConstants.FLOW_PREPARATION_DURATION,
String.valueOf(flowRunner.getFlowCreateTime()));
// FLow SLA option string
metaData.put(EventReporterConstants.SLA_OPTIONS, rootFlow.getSlaOptionStr());
// Flow executor type by versionSet
if (rootFlow.getVersionSet() != null) { // Flow version set is set when flow is
// executed in a container
metaData.put(EventReporterConstants.VERSION_SET,
ServerUtils.getVersionSetJsonString(rootFlow.getVersionSet()));
}
if (rootFlow.getDispatchMethod() == DispatchMethod.CONTAINERIZED) { // Determine executor type
metaData.put(EventReporterConstants.EXECUTOR_TYPE, String.valueOf(ExecutorType.KUBERNETES));
} else {
metaData.put(EventReporterConstants.EXECUTOR_TYPE, String.valueOf(ExecutorType.BAREMETAL));
}
//Flow Trigger Information
metaData.put(EventReporterConstants.EXECUTION_SOURCE, rootFlow.getExecutionSource());
// Project upload info
final ProjectFileHandler handler = flowRunner.projectFileHandler;
metaData.put(EventReporterConstants.PROJECT_FILE_UPLOAD_USER, handler.getUploader());
metaData.put(EventReporterConstants.PROJECT_FILE_UPLOADER_IP_ADDR,
handler.getUploaderIpAddr());
metaData.put(EventReporterConstants.PROJECT_FILE_NAME, handler.getFileName());
metaData.put(EventReporterConstants.PROJECT_FILE_UPLOAD_TIME,
String.valueOf(handler.getUploadTime()));
// Propagate flow properties to Event Reporter
if (FlowLoaderUtils.isAzkabanFlowVersion20(rootFlow.getAzkabanFlowVersion())) {
// In Flow 2.0, flow has designated properties (defined at its own level in Yaml)
FlowRunner.propagateMetadataFromProps(metaData, flow.getInputProps(), "flow", flow.getNestedId(),
FlowRunner.this.logger);
} else {
// In Flow 1.0, flow properties are combination of shared properties in individual files (order not defined,
// .. because it's loaded by fs list order and put in a HashMap).
Props combinedProps = new Props();
for (final Props sharedProp : flowRunner.sharedProps.values()) {
// sharedProp.getFlattened() gets its parent's props too, so we don't have to recurse
combinedProps.putAll(sharedProp.getFlattened());
}
// In Flow 1.0, flow's inputProps contains overrides, so apply that as override to combined shared props
combinedProps = new Props(combinedProps, flow.getInputProps());
FlowRunner.propagateMetadataFromProps(metaData, combinedProps, "flow", flow.getNestedId(),
FlowRunner.this.logger);
}
return metaData;
}
|
@param memoryUtilizedInBytes by the Azkaban flow.
|
getFlowMetadata
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
@Override
public synchronized void handleEvent(final Event event) {
if (event.getType().isFlowEventType()) {
final FlowRunner flowRunner = (FlowRunner) event.getRunner();
final ExecutableFlow rootFlow = flowRunner.getExecutableFlow();
final ExecutableFlowBase flow = (ExecutableFlowBase) event.getData().getNode();
if (event.getType() == EventType.FLOW_STARTED) {
// Estimate flow wait time duration including time taken to create pod (for containerized
// executions) and submit flowRunner, discrepancy caused by different system time in web
// server (where executable flow is submitted) and executor/container.
if (rootFlow.getSubmitTime() > 0 && flow == rootFlow) {
flowRunner.setFlowCreateTime(System.currentTimeMillis() - rootFlow.getSubmitTime());
}
FlowRunner.this.logger.info("Flow started: " + flow.getId());
FlowRunner.this.azkabanEventReporter.report(event.getType(), getFlowMetadata(flowRunner, flow));
} else if (event.getType() == EventType.FLOW_STATUS_CHANGED) {
if (flow.getStatus() == Status.KILLING || flow.getStatus() == Status.KILLED) {
FlowRunner.this.logger
.info("Flow is killed by " + flow.getModifiedBy() + ": " + flow.getId());
}
final Map<String, String> flowMetadata = getFlowMetadata(flowRunner, flow);
flowMetadata.put(EventReporterConstants.FLOW_STATUS, flow.getStatus().name());
FlowRunner.this.azkabanEventReporter.report(event.getType(), flowMetadata);
} else if (event.getType() == EventType.FLOW_FINISHED) {
FlowRunner.this.logger.info("Flow ended: " + flow.getId());
final Map<String, String> flowMetadata = getFlowMetadata(flowRunner, flow);
flowMetadata.put(EventReporterConstants.END_TIME, String.valueOf(flow.getEndTime()));
flowMetadata.put(EventReporterConstants.FLOW_STATUS, flow.getStatus().name());
// Add the unique effectiveUsers across all jobs as a comma separated string.
setEffectiveUsers(flowRunner, flowMetadata);
// Add resource utilization if they are present
cpuUtilized.ifPresent(val -> flowMetadata.put(EventReporterConstants.CPU_UTILIZED,
Double.toString(val)));
memoryUtilizedInBytes
.ifPresent(val -> flowMetadata.put(EventReporterConstants.MEMORY_UTILIZED_IN_BYTES,
Long.toString(val)));
logger.info("FLOW_FINISHED metadata: \n" + flowMetadata);
FlowRunner.this.azkabanEventReporter.report(event.getType(), flowMetadata);
}
}
}
|
@param memoryUtilizedInBytes by the Azkaban flow.
|
handleEvent
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
@VisibleForTesting
static void propagateMetadataFromProps(final Map<String, String> metaData, final Props inputProps,
final String nodeType, final String nodeName, final Logger logger) {
if (null == metaData || null == inputProps || null == logger ||
Strings.isNullOrEmpty(nodeType) || Strings.isNullOrEmpty(nodeName)) {
throw new IllegalArgumentException("Input params should not be null or empty.");
}
// Backward compatibility: Unless user specifies, this will be absent from flows and jobs
// .. if so, do a no-op like before
if (!inputProps.containsKey(AZKABAN_EVENT_REPORTING_PROPERTIES_TO_PROPAGATE)) {
return;
}
final String propsToPropagate = inputProps
.getString(AZKABAN_EVENT_REPORTING_PROPERTIES_TO_PROPAGATE);
if (Strings.isNullOrEmpty(propsToPropagate)) {
// Nothing to propagate
logger.info(
String.format("No properties to propagate to metadata for %s: %s", nodeType, nodeName));
return;
} else {
logger.info(String
.format("Propagating: %s to metadata for %s: %s", propsToPropagate, nodeType, nodeName));
}
final List<String> propsToPropagateList = SPLIT_ON_COMMA.splitToList(propsToPropagate);
for (final String propKey : propsToPropagateList) {
if (!inputProps.containsKey(propKey)) {
logger.warn(String.format("%s does not contains: %s property; "
+ "skipping propagation to metadata", nodeName, propKey));
continue;
}
metaData.put(propKey, inputProps.getString(propKey));
}
}
|
Propagate properties (specified in {@code AZKABAN_EVENT_REPORTING_PROPERTIES_TO_PROPAGATE})
to metadata for event reporting.
@param metaData Metadata map to update with properties.
@param inputProps Input properties for flow or job.
@param nodeType Flow or job.
@param nodeName Flow or job name.
@param logger Logger from invoking class for log sanity.
|
propagateMetadataFromProps
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
|
Apache-2.0
|
public boolean changePollingInterval(final long pollingIntervalMillis) {
final long oldVal = this.azkabanProps.getLong(ConfigurationKeys.AZKABAN_POLLING_INTERVAL_MS,
Constants.DEFAULT_AZKABAN_POLLING_INTERVAL_MS);
if (!this.pollingService.restart(pollingIntervalMillis)) {
return false;
}
if (this.azkabanProps.containsKey(ConfigurationKeys.AZKABAN_POLLING_INTERVAL_MS)) {
this.azkabanProps.put(ConfigurationKeys.AZKABAN_POLLING_INTERVAL_MS, pollingIntervalMillis);
}
LOGGER.info(String.format("Changed polling interval from %d to %d milliseconds", oldVal,
pollingIntervalMillis));
return true;
}
|
Change the polling interval to the newly specified value and also update the value that's
specified in the props
@param pollingIntervalMillis The new polling interval.
@return true if the Polling interval has changed successfully
|
changePollingInterval
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private void addStartupDependencyPathToProps(final Props props) {
if (this.storage.getDependencyRootPath() != null) {
props.put(ThinArchiveUtils.DEPENDENCY_STORAGE_ROOT_PATH_PROP,
this.storage.getDependencyRootPath());
}
}
|
Add the startup dependency path to props if the current storage instance returns a non-null
dependencyRootPath.
@param props Props to add the startup dependency path to.
|
addStartupDependencyPathToProps
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private void setgidPermissionOnExecutionDirectory() throws IOException {
LOGGER.info("Creating subprocess to run shell command: chmod g+s "
+ this.executionDirectory.toString());
Runtime.getRuntime().exec("chmod g+s " + this.executionDirectory.toString());
}
|
Setting the gid bit on the execution directory forces all files/directories created within the
directory to be a part of the group associated with the azkaban process. Then, when users
create their own files, the azkaban cleanup thread can properly remove them.
<p>
Java does not provide a standard library api for setting the gid bit because the gid bit is
system dependent, so the only way to set this bit is to start a new process and run the shell
command "chmod g+s " + execution directory name.
<p>
Note that this should work on most Linux distributions and MacOS, but will not work on
Windows.
|
setgidPermissionOnExecutionDirectory
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private TrackingThreadPool createExecutorService(final int nThreads) {
final boolean useNewThreadPool =
this.azkabanProps.getBoolean(EXECUTOR_USE_BOUNDED_THREADPOOL_QUEUE, false);
LOGGER.info("useNewThreadPool: " + useNewThreadPool);
if (useNewThreadPool) {
this.threadPoolQueueSize =
this.azkabanProps.getInt(EXECUTOR_THREADPOOL_WORKQUEUE_SIZE, nThreads);
LOGGER.info("workQueueSize: " + this.threadPoolQueueSize);
// using a bounded queue for the work queue. The default rejection policy
// {@ThreadPoolExecutor.AbortPolicy} is used
final TrackingThreadPool executor =
new TrackingThreadPool(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(this.threadPoolQueueSize), this);
return executor;
} else {
// the old way of using unbounded task queue.
// if the running tasks are taking a long time or stuck, this queue
// will be very very long.
return new TrackingThreadPool(nThreads, nThreads, 0L,
TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), this);
}
}
|
Setting the gid bit on the execution directory forces all files/directories created within the
directory to be a part of the group associated with the azkaban process. Then, when users
create their own files, the azkaban cleanup thread can properly remove them.
<p>
Java does not provide a standard library api for setting the gid bit because the gid bit is
system dependent, so the only way to set this bit is to start a new process and run the shell
command "chmod g+s " + execution directory name.
<p>
Note that this should work on most Linux distributions and MacOS, but will not work on
Windows.
|
createExecutorService
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public void setExecutorActive(final boolean isActive, final String host, final int port)
throws ExecutorManagerException, InterruptedException {
final Executor executor = this.executorLoader.fetchExecutor(host, port);
Preconditions.checkState(executor != null, "Unable to obtain self entry in DB");
if (executor.isActive() != isActive) {
executor.setActive(isActive);
this.executorLoader.updateExecutor(executor);
} else {
LOGGER.info(
"Set active action ignored. Executor is already " + (isActive ? "active" : "inactive"));
}
this.active = isActive;
if (!this.active) {
// When deactivating this executor, this call will wait to return until every thread in {@link
// #createFlowRunner} has finished. When deploying new executor, old running executor will be
// deactivated before new one is activated and only one executor is allowed to
// delete/hard-linking project dirs to avoid race condition described in {@link
// FlowPreparer#setup}. So to make deactivation process block until flow preparation work
// finishes guarantees the old executor won't access {@link FlowPreparer#setup} after
// deactivation.
waitUntilFlowPreparationFinish();
}
}
|
Setting the gid bit on the execution directory forces all files/directories created within the
directory to be a part of the group associated with the azkaban process. Then, when users
create their own files, the azkaban cleanup thread can properly remove them.
<p>
Java does not provide a standard library api for setting the gid bit because the gid bit is
system dependent, so the only way to set this bit is to start a new process and run the shell
command "chmod g+s " + execution directory name.
<p>
Note that this should work on most Linux distributions and MacOS, but will not work on
Windows.
|
setExecutorActive
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public void setActiveInternal(final boolean isActive) {
this.active = isActive;
}
|
Setting the gid bit on the execution directory forces all files/directories created within the
directory to be a part of the group associated with the azkaban process. Then, when users
create their own files, the azkaban cleanup thread can properly remove them.
<p>
Java does not provide a standard library api for setting the gid bit because the gid bit is
system dependent, so the only way to set this bit is to start a new process and run the shell
command "chmod g+s " + execution directory name.
<p>
Note that this should work on most Linux distributions and MacOS, but will not work on
Windows.
|
setActiveInternal
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private void waitUntilFlowPreparationFinish() throws InterruptedException {
final Duration SLEEP_INTERVAL = Duration.ofSeconds(5);
while (this.preparingFlowCount.intValue() != 0) {
LOGGER.info(this.preparingFlowCount + " flow(s) is/are still being setup before complete "
+ "deactivation.");
Thread.sleep(SLEEP_INTERVAL.toMillis());
}
}
|
Wait until ongoing flow preparation work finishes.
|
waitUntilFlowPreparationFinish
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public long getLastFlowSubmittedTime() {
// Note: this is not thread safe and may result in providing dirty data.
// we will provide this data as is for now and will revisit if there
// is a string justification for change.
return this.lastFlowSubmittedDate;
}
|
Wait until ongoing flow preparation work finishes.
|
getLastFlowSubmittedTime
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public Props getGlobalProps() {
return this.globalProps;
}
|
Wait until ongoing flow preparation work finishes.
|
getGlobalProps
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public void setGlobalProps(final Props globalProps) {
this.globalProps = globalProps;
}
|
Wait until ongoing flow preparation work finishes.
|
setGlobalProps
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public void submitFlow(final int execId) throws ExecutorManagerException {
if (isAlreadyRunning(execId)) {
return;
}
final FlowRunner runner = createFlowRunner(execId);
// Check again.
if (isAlreadyRunning(execId)) {
return;
}
submitFlowRunner(runner);
}
|
Wait until ongoing flow preparation work finishes.
|
submitFlow
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private boolean isAlreadyRunning(final int execId) throws ExecutorManagerException {
if (this.runningFlows.containsKey(execId)) {
LOGGER.info("Execution " + execId + " is already in running.");
if (!this.submittedFlows.containsValue(execId)) {
// Execution had been added to running flows but not submitted - something's wrong.
// Return a response with error: this is a cue for the dispatcher to retry or finalize the
// execution as failed.
throw new ExecutorManagerException("Execution " + execId +
" is in runningFlows but not in submittedFlows. Most likely submission had failed.");
}
// Already running, everything seems fine. Report as a successful submission.
return true;
}
return false;
}
|
Wait until ongoing flow preparation work finishes.
|
isAlreadyRunning
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private boolean isExecutorSpecified(final ExecutableFlow flow) {
return flow.getExecutionOptions().getFlowParameters()
.containsKey(ExecutionOptions.USE_EXECUTOR);
}
|
return whether this execution has useExecutor defined. useExecutor is for running test
executions on inactive executor.
|
isExecutorSpecified
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private FlowRunner createFlowRunner(final int execId) throws ExecutorManagerException {
final ExecutableFlow flow = this.executorLoader.fetchExecutableFlow(execId);
if (flow == null) {
throw new ExecutorManagerException("Error loading flow with exec " + execId);
}
// Sets up the project files and execution directory.
this.preparingFlowCount.incrementAndGet();
final Timer.Context flowPrepTimerContext = this.execMetrics.getFlowSetupTimerContext();
try {
if (this.active || isExecutorSpecified(flow)) {
this.flowPreparer.setup(flow);
} else {
// Unset the executor.
this.executorLoader.unsetExecutorIdForExecution(execId);
throw new ExecutorManagerException("executor became inactive before setting up the "
+ "flow " + execId);
}
} finally {
this.preparingFlowCount.decrementAndGet();
flowPrepTimerContext.stop();
}
// Setup flow runner
FlowWatcher watcher = null;
final ExecutionOptions options = flow.getExecutionOptions();
if (options.getPipelineExecutionId() != null) {
final Integer pipelineExecId = options.getPipelineExecutionId();
final FlowRunner runner = this.runningFlows.get(pipelineExecId);
if (runner != null) {
watcher = new LocalFlowWatcher(runner);
} else {
// also ends up here if execute is called with pipelineExecId that's not running any more
// (it could have just finished, for example)
watcher = new RemoteFlowWatcher(pipelineExecId, this.executorLoader);
}
}
int numJobThreads = this.numJobThreadPerFlow;
if (options.getFlowParameters().containsKey(FLOW_NUM_JOB_THREADS)) {
try {
if (!ProjectWhitelist.isXmlFileLoaded()) {
ProjectWhitelist.load(azkabanProps);
}
final int numJobs =
Integer.valueOf(options.getFlowParameters().get(
FLOW_NUM_JOB_THREADS));
LOGGER.info("Num of job threads read from flow parameter is " + numJobs);
if (numJobs > 0 && (numJobs <= numJobThreads || ProjectWhitelist
.isProjectWhitelisted(flow.getProjectId(),
WhitelistType.NumJobPerFlow))) {
numJobThreads = numJobs;
}
} catch (final Exception e) {
throw new ExecutorManagerException(
"Failed to set the number of job threads "
+ options.getFlowParameters().get(FLOW_NUM_JOB_THREADS)
+ " for flow " + execId, e);
}
}
//Contact Flow Global Configuration Manager to re-configure Flow Runner if there is any ramp-up configuration
this.flowRampManager
.configure(flow, FileIOUtils.getDirectory(this.projectDirectory, flow.getDirectory()));
final FlowRunner runner =
new FlowRunner(flow, this.executorLoader, this.executionLogsLoader, this.projectLoader,
this.jobtypeManager, this.azkabanProps, this.azkabanEventReporter, this.alerterHolder,
this.commonMetrics, this.execMetrics);
runner.setFlowWatcher(watcher)
.setJobLogSettings(this.jobLogChunkSize, this.jobLogNumFiles)
.setValidateProxyUser(this.validateProxyUser)
.setNumJobThreads(numJobThreads)
.addListeners(this, this.flowRampManager);
configureFlowLevelMetrics(runner);
return runner;
}
|
return whether this execution has useExecutor defined. useExecutor is for running test
executions on inactive executor.
|
createFlowRunner
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private void submitFlowRunner(final FlowRunner runner) throws ExecutorManagerException {
this.runningFlows.put(runner.getExecutionId(), runner);
try {
// The executorService already has a queue.
// The submit method below actually returns an instance of FutureTask,
// which implements interface RunnableFuture, which extends both
// Runnable and Future interfaces
final Future<?> future = this.executorService.submit(runner);
// keep track of this future
this.submittedFlows.put(future, runner.getExecutionId());
// update the last submitted time.
this.lastFlowSubmittedDate = System.currentTimeMillis();
} catch (final RejectedExecutionException re) {
this.runningFlows.remove(runner.getExecutionId());
final StringBuffer errorMsg = new StringBuffer(
"Azkaban executor can't execute any more flows. ");
if (this.executorService.isShutdown()) {
errorMsg.append("The executor is being shut down.");
}
throw new ExecutorManagerException(errorMsg.toString(), re);
}
}
|
return whether this execution has useExecutor defined. useExecutor is for running test
executions on inactive executor.
|
submitFlowRunner
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private void configureFlowLevelMetrics(final FlowRunner flowRunner) {
LOGGER.info("Configuring Azkaban metrics tracking for flow runner object");
if (MetricReportManager.isAvailable()) {
final MetricReportManager metricManager = MetricReportManager.getInstance();
// Adding NumFailedFlow Metric listener
flowRunner.addListener((NumFailedFlowMetric) metricManager
.getMetricFromName(NumFailedFlowMetric.NUM_FAILED_FLOW_METRIC_NAME));
}
}
|
Configure Azkaban metrics tracking for a new flowRunner instance
|
configureFlowLevelMetrics
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
@Override
public void cancelJobBySLA(final int execId, final String jobId)
throws ExecutorManagerException {
final FlowRunner flowRunner = this.runningFlows.get(execId);
if (flowRunner == null) {
throw new ExecutorManagerException("Execution " + execId
+ " is not running.");
}
flowRunner.getExecutableFlow().setModifiedBy("SLA");
for (final JobRunner jobRunner : flowRunner.getActiveJobRunners()) {
if (jobRunner.getJobId().equals(jobId)) {
LOGGER.info("Killing job " + jobId + " in execution " + execId + " by SLA");
jobRunner.killBySLA();
break;
}
}
}
|
Configure Azkaban metrics tracking for a new flowRunner instance
|
cancelJobBySLA
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
@Override
public void cancelFlow(final int execId, final String user)
throws ExecutorManagerException {
final FlowRunner flowRunner = this.runningFlows.get(execId);
if (flowRunner == null) {
throw new ExecutorManagerException("Execution " + execId + " is not running.");
}
// account for those unexpected cases where a completed execution remains in the runningFlows
//collection due to, for example, the FLOW_FINISHED event not being emitted/handled.
if (Status.isStatusFinished(flowRunner.getExecutableFlow().getStatus())) {
LOGGER.warn("Found a finished execution in the list of running flows: " + execId);
throw new ExecutorManagerException("Execution " + execId + " is already finished.");
}
flowRunner.kill(user);
}
|
Configure Azkaban metrics tracking for a new flowRunner instance
|
cancelFlow
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
@Override
public void pauseFlow(final int execId, final String user)
throws ExecutorManagerException {
final FlowRunner runner = this.runningFlows.get(execId);
if (runner == null) {
throw new ExecutorManagerException("Execution " + execId
+ " is not running.");
}
try {
runner.pause(user);
} catch (final IllegalStateException e) {
throw new ExecutorManagerException(e.getMessage());
}
}
|
Configure Azkaban metrics tracking for a new flowRunner instance
|
pauseFlow
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
@Override
public void resumeFlow(final int execId, final String user)
throws ExecutorManagerException {
final FlowRunner runner = this.runningFlows.get(execId);
if (runner == null) {
throw new ExecutorManagerException("Execution " + execId
+ " is not running.");
}
runner.resume(user);
}
|
Configure Azkaban metrics tracking for a new flowRunner instance
|
resumeFlow
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
@Override
public void retryFailures(final int execId, final String user)
throws ExecutorManagerException {
final FlowRunner flowRunner = this.runningFlows.get(execId);
if (flowRunner == null) {
throw new ExecutorManagerException("Execution " + execId
+ " is not running.");
}
flowRunner.retryFailures(user);
}
|
Configure Azkaban metrics tracking for a new flowRunner instance
|
retryFailures
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public ExecutableFlow getExecutableFlow(final int execId) {
final FlowRunner runner = this.runningFlows.get(execId);
if (runner == null) {
return this.recentlyFinishedFlows.get(execId);
}
return runner.getExecutableFlow();
}
|
Configure Azkaban metrics tracking for a new flowRunner instance
|
getExecutableFlow
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private void deleteExecutionDir(final int executionId) {
LOGGER.info("Deleting execution directory for " + executionId);
synchronized (this.executionDirDeletionSync) {
LOGGER.info("Starting execution directory deletion for " + executionId);
final Path flowExecutionDir = Paths.get(this.executionDirectory.toPath().toString(),
String.valueOf(executionId));
try {
FileUtils.deleteDirectory(flowExecutionDir.toFile());
} catch (final IOException e) {
LOGGER.warn("Error when deleting directory " + flowExecutionDir.toAbsolutePath() + ".", e);
}
}
}
|
delete execution dir pertaining to the given execution id
|
deleteExecutionDir
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
@Override
public void handleEvent(final Event event) {
if (!(event.getData().isRootFlowEvent())) {
return;
}
if (event.getType() == EventType.FLOW_FINISHED || event.getType() == EventType.FLOW_STARTED) {
final FlowRunner flowRunner = (FlowRunner) event.getRunner();
final ExecutableFlow flow = flowRunner.getExecutableFlow();
if (event.getType() == EventType.FLOW_FINISHED) {
this.recentlyFinishedFlows.put(flow.getExecutionId(), flow);
LOGGER.info("Flow " + flow.getExecutionId()
+ " is finished. Adding it to recently finished flows list.");
this.runningFlows.remove(flow.getExecutionId());
this.deleteExecutionDir(flow.getExecutionId());
} else if (event.getType() == EventType.FLOW_STARTED) {
// add flow level SLA checker
this.triggerManager
.addTrigger(flow.getExecutionId(), SlaOption.getFlowLevelSLAOptions(flow
.getExecutionOptions().getSlaOptions()));
}
}
}
|
delete execution dir pertaining to the given execution id
|
handleEvent
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public LogData readFlowLogs(final int execId, final int startByte, final int length)
throws ExecutorManagerException {
final FlowRunner runner = this.runningFlows.get(execId);
if (runner == null) {
throw new ExecutorManagerException("Running flow " + execId
+ " not found.");
}
final File dir = runner.getExecutionDir();
if (dir != null && dir.exists()) {
try {
synchronized (this.executionDirDeletionSync) {
if (!dir.exists()) {
throw new ExecutorManagerException(
"Execution dir file doesn't exist. Probably has been deleted");
}
final File logFile = runner.getFlowLogFile();
if (logFile != null && logFile.exists()) {
return FileIOUtils.readUtf8File(logFile, startByte, length);
} else {
throw new ExecutorManagerException("Flow log file doesn't exist.");
}
}
} catch (final IOException e) {
throw new ExecutorManagerException(e);
}
}
throw new ExecutorManagerException(
"Error reading file. Log directory doesn't exist.");
}
|
delete execution dir pertaining to the given execution id
|
readFlowLogs
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public LogData readJobLogs(final int execId, final String jobId, final int attempt,
final int startByte, final int length) throws ExecutorManagerException {
final FlowRunner runner = this.runningFlows.get(execId);
if (runner == null) {
throw new ExecutorManagerException("Running flow " + execId
+ " not found.");
}
final File dir = runner.getExecutionDir();
if (dir != null && dir.exists()) {
try {
synchronized (this.executionDirDeletionSync) {
if (!dir.exists()) {
throw new ExecutorManagerException(
"Execution dir file doesn't exist. Probably has beend deleted");
}
final File logFile = runner.getJobLogFile(jobId, attempt);
if (logFile != null && logFile.exists()) {
return FileIOUtils.readUtf8File(logFile, startByte, length);
} else {
throw new ExecutorManagerException("Job log file doesn't exist.");
}
}
} catch (final IOException e) {
throw new ExecutorManagerException(e);
}
}
throw new ExecutorManagerException(
"Error reading file. Log directory doesn't exist.");
}
|
delete execution dir pertaining to the given execution id
|
readJobLogs
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public List<Object> readJobAttachments(final int execId, final String jobId, final int attempt)
throws ExecutorManagerException {
final FlowRunner runner = this.runningFlows.get(execId);
if (runner == null) {
throw new ExecutorManagerException("Running flow " + execId
+ " not found.");
}
final File dir = runner.getExecutionDir();
if (dir == null || !dir.exists()) {
throw new ExecutorManagerException(
"Error reading file. Log directory doesn't exist.");
}
try {
synchronized (this.executionDirDeletionSync) {
if (!dir.exists()) {
throw new ExecutorManagerException(
"Execution dir file doesn't exist. Probably has been deleted");
}
final File attachmentFile = runner.getJobAttachmentFile(jobId, attempt);
if (attachmentFile == null || !attachmentFile.exists()) {
return null;
}
final List<Object> jobAttachments =
(ArrayList<Object>) JSONUtils.parseJSONFromFile(attachmentFile);
return jobAttachments;
}
} catch (final IOException e) {
throw new ExecutorManagerException(e);
}
}
|
delete execution dir pertaining to the given execution id
|
readJobAttachments
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public JobMetaData readJobMetaData(final int execId, final String jobId, final int attempt,
final int startByte, final int length) throws ExecutorManagerException {
final FlowRunner runner = this.runningFlows.get(execId);
if (runner == null) {
throw new ExecutorManagerException("Running flow " + execId
+ " not found.");
}
final File dir = runner.getExecutionDir();
if (dir != null && dir.exists()) {
try {
synchronized (this.executionDirDeletionSync) {
if (!dir.exists()) {
throw new ExecutorManagerException(
"Execution dir file doesn't exist. Probably has beend deleted");
}
final File metaDataFile = runner.getJobMetaDataFile(jobId, attempt);
if (metaDataFile != null && metaDataFile.exists()) {
return FileIOUtils.readUtf8MetaDataFile(metaDataFile, startByte,
length);
} else {
throw new ExecutorManagerException("Job log file doesn't exist.");
}
}
} catch (final IOException e) {
throw new ExecutorManagerException(e);
}
}
throw new ExecutorManagerException(
"Error reading file. Log directory doesn't exist.");
}
|
delete execution dir pertaining to the given execution id
|
readJobMetaData
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public long getLastCleanerThreadCheckTime() {
return this.lastCleanerThreadCheckTime;
}
|
delete execution dir pertaining to the given execution id
|
getLastCleanerThreadCheckTime
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public boolean isCleanerThreadActive() {
return this.cleanerThread.isAlive();
}
|
delete execution dir pertaining to the given execution id
|
isCleanerThreadActive
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public State getCleanerThreadState() {
return this.cleanerThread.getState();
}
|
delete execution dir pertaining to the given execution id
|
getCleanerThreadState
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public boolean isExecutorThreadPoolShutdown() {
return this.executorService.isShutdown();
}
|
delete execution dir pertaining to the given execution id
|
isExecutorThreadPoolShutdown
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public int getNumQueuedFlows() {
return this.executorService.getQueue().size();
}
|
delete execution dir pertaining to the given execution id
|
getNumQueuedFlows
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public int getNumRunningFlows() {
return this.executorService.getActiveCount();
}
|
delete execution dir pertaining to the given execution id
|
getNumRunningFlows
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public String getRunningFlowIds() {
// The in progress tasks are actually of type FutureTask
final Set<Runnable> inProgressTasks = this.executorService.getInProgressTasks();
final List<Integer> runningFlowIds =
new ArrayList<>(inProgressTasks.size());
for (final Runnable task : inProgressTasks) {
// add casting here to ensure it matches the expected type in
// submittedFlows
final Integer execId = this.submittedFlows.get((Future<?>) task);
if (execId != null) {
runningFlowIds.add(execId);
} else {
LOGGER.warn("getRunningFlowIds: got null execId for task: " + task);
}
}
Collections.sort(runningFlowIds);
return runningFlowIds.toString();
}
|
delete execution dir pertaining to the given execution id
|
getRunningFlowIds
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public String getQueuedFlowIds() {
final List<Integer> flowIdList =
new ArrayList<>(this.executorService.getQueue().size());
for (final Runnable task : this.executorService.getQueue()) {
final Integer execId = this.submittedFlows.get(task);
if (execId != null) {
flowIdList.add(execId);
} else {
LOGGER.warn("getQueuedFlowIds: got null execId for queuedTask: " + task);
}
}
Collections.sort(flowIdList);
return flowIdList.toString();
}
|
delete execution dir pertaining to the given execution id
|
getQueuedFlowIds
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public int getMaxNumRunningFlows() {
return this.numThreads;
}
|
delete execution dir pertaining to the given execution id
|
getMaxNumRunningFlows
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public int getTheadPoolQueueSize() {
return this.threadPoolQueueSize;
}
|
delete execution dir pertaining to the given execution id
|
getTheadPoolQueueSize
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public int getTotalNumExecutedFlows() {
return this.executorService.getTotalTasks();
}
|
delete execution dir pertaining to the given execution id
|
getTotalNumExecutedFlows
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
@Override
public void beforeExecute(final Runnable r) {
}
|
delete execution dir pertaining to the given execution id
|
beforeExecute
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
@Override
public void afterExecute(final Runnable r) {
this.submittedFlows.remove(r);
}
|
delete execution dir pertaining to the given execution id
|
afterExecute
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public void shutdown() {
LOGGER.warn("Shutting down FlowRunnerManager...");
if (isPollDispatchMethodEnabled()) {
this.pollingService.shutdown();
}
this.executorService.shutdown();
boolean result = false;
while (!result) {
LOGGER.info("Awaiting Shutdown. # of executing flows: " + getNumRunningFlows());
try {
result = this.executorService.awaitTermination(1, TimeUnit.MINUTES);
} catch (final InterruptedException e) {
LOGGER.error(e.getMessage());
}
}
this.flowPreparer.shutdown();
LOGGER.warn("Shutdown FlowRunnerManager complete.");
}
|
This shuts down the flow runner. The call is blocking and awaits execution of all jobs.
|
shutdown
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public void shutdownNow() {
LOGGER.warn("Shutting down FlowRunnerManager now...");
if (isPollDispatchMethodEnabled()) {
this.pollingService.shutdown();
}
this.executorService.shutdownNow();
this.triggerManager.shutdown();
}
|
This attempts shuts down the flow runner immediately (unsafe). This doesn't wait for jobs to
finish but interrupts all threads.
|
shutdownNow
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private boolean isPollDispatchMethodEnabled() {
return DispatchMethod.isPollMethodEnabled(this.azkabanProps
.getString(ConfigurationKeys.AZKABAN_EXECUTION_DISPATCH_METHOD,
DispatchMethod.PUSH.name()));
}
|
This attempts shuts down the flow runner immediately (unsafe). This doesn't wait for jobs to
finish but interrupts all threads.
|
isPollDispatchMethodEnabled
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public void deleteExecutionDirectory() {
LOGGER.warn("Deleting execution dir: " + this.executionDirectory.getAbsolutePath());
try {
FileUtils.deleteDirectory(this.executionDirectory);
} catch (final IOException e) {
LOGGER.error(e.getMessage());
}
}
|
Deleting old execution directory to free disk space.
|
deleteExecutionDirectory
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public void shutdown() {
this.shutdown = true;
this.interrupt();
}
|
Deleting old execution directory to free disk space.
|
shutdown
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private boolean isFlowRunningLongerThan(final ExecutableFlow flow,
final long flowMaxRunningTimeInMins) {
return Status.nonFinishingStatusAfterFlowStartsSet.contains(flow.getStatus())
&& flow.getStartTime() > 0
&& TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - flow.getStartTime())
>= flowMaxRunningTimeInMins;
}
|
Deleting old execution directory to free disk space.
|
isFlowRunningLongerThan
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
@Override
public void run() {
while (!this.shutdown) {
synchronized (this) {
try {
FlowRunnerManager.this.lastCleanerThreadCheckTime = System.currentTimeMillis();
FlowRunnerManager.LOGGER.info("# of executing flows: " + getNumRunningFlows());
// Cleanup old stuff.
final long currentTime = System.currentTimeMillis();
if (currentTime - RECENTLY_FINISHED_INTERVAL_MS > this.lastRecentlyFinishedCleanTime) {
FlowRunnerManager.LOGGER.info("Cleaning recently finished");
cleanRecentlyFinished();
this.lastRecentlyFinishedCleanTime = currentTime;
}
if (this.flowMaxRunningTimeInMins > 0
&& currentTime - LONG_RUNNING_FLOW_KILLING_INTERVAL_MS
> this.lastLongRunningFlowCleanTime) {
FlowRunnerManager.LOGGER
.info(String.format("Killing long jobs running longer than %s mins",
this.flowMaxRunningTimeInMins));
for (final FlowRunner flowRunner : FlowRunnerManager.this.runningFlows.values()) {
if (isFlowRunningLongerThan(flowRunner.getExecutableFlow(),
this.flowMaxRunningTimeInMins)) {
FlowRunnerManager.LOGGER.info(String
.format("Killing job [id: %s, status: %s]. It has been running for %s mins",
flowRunner.getExecutableFlow().getId(),
flowRunner.getExecutableFlow().getStatus(), TimeUnit.MILLISECONDS
.toMinutes(System.currentTimeMillis() - flowRunner.getExecutableFlow()
.getStartTime())));
flowRunner.kill();
}
}
this.lastLongRunningFlowCleanTime = currentTime;
}
wait(FlowRunnerManager.RECENTLY_FINISHED_TIME_TO_LIVE);
} catch (final InterruptedException e) {
FlowRunnerManager.LOGGER.info("Interrupted. Probably to shut down.", e.getMessage());
} catch (final Throwable t) {
t.printStackTrace();
FlowRunnerManager.LOGGER.warn(
"Uncaught throwable, please look into why it is not caught", t.getMessage());
}
}
}
}
|
Deleting old execution directory to free disk space.
|
run
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private void cleanRecentlyFinished() {
final long cleanupThreshold =
System.currentTimeMillis() - FlowRunnerManager.RECENTLY_FINISHED_TIME_TO_LIVE;
final ArrayList<Integer> executionToKill = new ArrayList<>();
for (final ExecutableFlow flow : FlowRunnerManager.this.recentlyFinishedFlows.values()) {
if (flow.getEndTime() < cleanupThreshold) {
executionToKill.add(flow.getExecutionId());
}
}
for (final Integer id : executionToKill) {
FlowRunnerManager.LOGGER.info("Cleaning execution " + id
+ " from recently finished flows list.");
FlowRunnerManager.this.recentlyFinishedFlows.remove(id);
}
}
|
Deleting old execution directory to free disk space.
|
cleanRecentlyFinished
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public boolean restart(final long newPollingIntervalMs) {
if (newPollingIntervalMs <= 0) {
FlowRunnerManager.LOGGER.error(String.format("Can not set a negative polling interval: %d "
+ "milliseconds", newPollingIntervalMs));
return false;
}
if (this.futureTask != null) {
FlowRunnerManager.LOGGER.info(String.format("Canceling the existing polling schedule (%d "
+ "ms)", this.pollingIntervalMs));
if (!this.futureTask.cancel(false)) {
FlowRunnerManager.LOGGER.error(String.format(
"Failure in canceling the existing polling schedule (%d ms) prevented us from "
+ "setting a new polling schedule (%d ms)",
this.pollingIntervalMs, newPollingIntervalMs));
return false;
}
}
this.pollingIntervalMs = newPollingIntervalMs;
start();
return (this.futureTask != null);
}
|
Cancels the existing polling schedule and starts a new one. This can be used to change the
polling interval because a polling interval of an existing schedule can not be changed.
@param newPollingIntervalMs The desired polling interval.
@return true if a restart has happened with the new polling interval.
|
restart
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private void pollExecution() {
if (this.executorId == -1) {
if (AzkabanExecutorServer.getApp() != null) {
try {
final Executor executor = requireNonNull(FlowRunnerManager.this.executorLoader
.fetchExecutor(AzkabanExecutorServer.getApp().getHost(),
AzkabanExecutorServer.getApp().getPort()), "The executor can not be null");
this.executorId = executor.getId();
} catch (final Exception e) {
FlowRunnerManager.LOGGER.error("Failed to fetch executor ", e);
}
}
} else if (this.pollingCriteria.shouldPoll()) {
try {
final int execId;
if (FlowRunnerManager.this.azkabanProps
.getBoolean(ConfigurationKeys.AZKABAN_POLLING_LOCK_ENABLED, false)) {
execId = FlowRunnerManager.this.executorLoader.selectAndUpdateExecutionWithLocking(
this.executorId, FlowRunnerManager.this.active, DispatchMethod.POLL);
} else {
execId = FlowRunnerManager.this.executorLoader.selectAndUpdateExecution(this.executorId,
FlowRunnerManager.this.active, DispatchMethod.POLL);
}
FlowRunnerManager.this.execMetrics.markOnePoll();
if (execId == -1) {
FlowRunnerManager.LOGGER.info("Polling found no flow in the queue.");
} else {
FlowRunnerManager.LOGGER.info("Polling found a flow. Submitting flow " + execId);
try {
submitFlow(execId);
FlowRunnerManager.this.commonMetrics.markDispatchSuccess();
this.numRetries = 0;
} catch (final ExecutorManagerException e) {
// If the flow fails to be submitted, then unset its executor id in DB so that other
// executors can pick up this flow and submit again.
FlowRunnerManager.this.executorLoader.unsetExecutorIdForExecution(execId);
throw new ExecutorManagerException(
"Unset executor id " + this.executorId + " for execution " + execId, e);
}
}
} catch (final Exception e) {
FlowRunnerManager.LOGGER.error("Failed to submit flow ", e);
FlowRunnerManager.this.commonMetrics.markDispatchFail();
this.numRetries = this.numRetries + 1;
try {
// Implement exponential backoff retries when flow submission fails,
// i.e., sleep 1s, 2s, 4s, 8s ... before next retries.
Thread.sleep((long) (Math.pow(2, this.numRetries) * 1000));
} catch (final InterruptedException ie) {
FlowRunnerManager.LOGGER
.warn("Sleep after flow submission failure was interrupted - ignoring");
}
}
}
}
|
Cancels the existing polling schedule and starts a new one. This can be used to change the
polling interval because a polling interval of an existing schedule can not be changed.
@param newPollingIntervalMs The desired polling interval.
@return true if a restart has happened with the new polling interval.
|
pollExecution
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public void shutdown() {
this.scheduler.shutdown();
this.scheduler.shutdownNow();
}
|
Cancels the existing polling schedule and starts a new one. This can be used to change the
polling interval because a polling interval of an existing schedule can not be changed.
@param newPollingIntervalMs The desired polling interval.
@return true if a restart has happened with the new polling interval.
|
shutdown
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
public boolean shouldPoll() {
if (satisfiesFlowThreadsAvailableCriteria() && satisfiesFreeMemoryCriteria()
&& satisfiesCpuUtilizationCriteria()) {
return true;
}
return false;
}
|
Cancels the existing polling schedule and starts a new one. This can be used to change the
polling interval because a polling interval of an existing schedule can not be changed.
@param newPollingIntervalMs The desired polling interval.
@return true if a restart has happened with the new polling interval.
|
shouldPoll
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private boolean satisfiesFlowThreadsAvailableCriteria() {
final boolean flowThreadsAvailableConfig = this.azkabanProps.
getBoolean(ConfigurationKeys.AZKABAN_POLLING_CRITERIA_FLOW_THREADS_AVAILABLE, false);
// allow polling if not present or configured with invalid value
if (!flowThreadsAvailableConfig) {
return true;
}
final int remainingFlowThreads = FlowRunnerManager.this.getMaxNumRunningFlows() -
FlowRunnerManager.this.getNumRunningFlows();
final boolean flowThreadsAvailable = remainingFlowThreads > 0;
if (this.areFlowThreadsAvailable != flowThreadsAvailable) {
this.areFlowThreadsAvailable = flowThreadsAvailable;
if (flowThreadsAvailable) {
FlowRunnerManager.LOGGER.info("Polling criteria satisfied: available flow threads (" +
remainingFlowThreads + ").");
} else {
FlowRunnerManager.LOGGER.info("Polling criteria NOT satisfied: available flow threads (" +
remainingFlowThreads + ").");
}
}
return flowThreadsAvailable;
}
|
Cancels the existing polling schedule and starts a new one. This can be used to change the
polling interval because a polling interval of an existing schedule can not be changed.
@param newPollingIntervalMs The desired polling interval.
@return true if a restart has happened with the new polling interval.
|
satisfiesFlowThreadsAvailableCriteria
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private boolean satisfiesFreeMemoryCriteria() {
final int minFreeMemoryConfigGb = this.azkabanProps.
getInt(ConfigurationKeys.AZKABAN_POLLING_CRITERIA_MIN_FREE_MEMORY_GB, 0);
// allow polling if not present or configured with invalid value
if (minFreeMemoryConfigGb <= 0) {
return true;
}
final int minFreeMemoryConfigKb = minFreeMemoryConfigGb * 1024 * 1024;
final boolean haveEnoughMemory =
this.memInfo.isFreePhysicalMemoryAbove(minFreeMemoryConfigKb);
if (this.isFreeMemoryAvailable != haveEnoughMemory) {
this.isFreeMemoryAvailable = haveEnoughMemory;
if (haveEnoughMemory) {
FlowRunnerManager.LOGGER.info("Polling criteria satisfied: available free memory.");
} else {
FlowRunnerManager.LOGGER.info("Polling criteria NOT satisfied: available free memory.");
}
}
return haveEnoughMemory;
}
|
Cancels the existing polling schedule and starts a new one. This can be used to change the
polling interval because a polling interval of an existing schedule can not be changed.
@param newPollingIntervalMs The desired polling interval.
@return true if a restart has happened with the new polling interval.
|
satisfiesFreeMemoryCriteria
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
private boolean satisfiesCpuUtilizationCriteria() {
final double maxCpuUtilizationConfig = this.azkabanProps.
getDouble(ConfigurationKeys.AZKABAN_POLLING_CRITERIA_MAX_CPU_UTILIZATION_PCT, 100);
// allow polling if criteria not present or configured with invalid value
if (maxCpuUtilizationConfig <= 0 || maxCpuUtilizationConfig >= 100) {
return true;
}
final double cpuLoad = this.cpuUtil.getCpuLoad();
if (cpuLoad == -1) {
return true;
}
final boolean cpuLoadWithinParams = cpuLoad < maxCpuUtilizationConfig;
if (this.isCpuLoadUnderMax != cpuLoadWithinParams) {
this.isCpuLoadUnderMax = cpuLoadWithinParams;
if (cpuLoadWithinParams) {
FlowRunnerManager.LOGGER.info("Polling criteria satisfied: Cpu utilization (" +
cpuLoad + "%).");
} else {
FlowRunnerManager.LOGGER.info("Polling criteria NOT satisfied: Cpu utilization (" +
cpuLoad + "%).");
}
}
return cpuLoadWithinParams;
}
|
Cancels the existing polling schedule and starts a new one. This can be used to change the
polling interval because a polling interval of an existing schedule can not be changed.
@param newPollingIntervalMs The desired polling interval.
@return true if a restart has happened with the new polling interval.
|
satisfiesCpuUtilizationCriteria
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java
|
Apache-2.0
|
@Deprecated
@Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
throws ServletException, IOException {
doPost(req, resp);
}
|
@deprecated GET available for seamless upgrade. azkaban-web now uses POST.
|
doGet
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JMXHttpServlet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JMXHttpServlet.java
|
Apache-2.0
|
@Override
protected void doPost(final HttpServletRequest req, final HttpServletResponse resp)
throws ServletException, IOException {
final Map<String, Object> ret = new HashMap<>();
if (hasParam(req, JMX_GET_MBEANS)) {
ret.put("mbeans", this.server.getMBeanRegistrationManager().getMBeanNames());
} else if (hasParam(req, JMX_GET_ALL_MBEAN_ATTRIBUTES)) {
if (!hasParam(req, JMX_MBEAN)) {
ret.put("error", "Parameters 'mbean' must be set");
} else {
ret.putAll(
this.server.getMBeanRegistrationManager().getMBeanResult(getParam(req, JMX_MBEAN)));
}
}
JSONUtils.toJSON(ret, resp.getOutputStream(), true);
}
|
@deprecated GET available for seamless upgrade. azkaban-web now uses POST.
|
doPost
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JMXHttpServlet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JMXHttpServlet.java
|
Apache-2.0
|
public Set<String> getPipelineWatchedJobs() {
return this.pipelineJobs;
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
getPipelineWatchedJobs
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
public long getDelayStart() {
return this.delayStartMs;
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
getDelayStart
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
public void setDelayStart(final long delayMS) {
this.delayStartMs = delayMS;
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
setDelayStart
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
public ExecutableNode getNode() {
return this.node;
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
getNode
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
public String getJobId() {
return this.node.getId();
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
getJobId
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
public String getLogFilePath() {
return this.logFile == null ? null : this.logFile.getPath();
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
getLogFilePath
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private void createLogger() {
// Create logger
synchronized (logCreatorLock) {
final String loggerName =
System.currentTimeMillis() + "." + this.executionId + "."
+ this.jobId;
this.logger = Logger.getLogger(loggerName);
try {
attachFileAppender(createFileAppender());
} catch (final IOException e) {
removeAppender(this.jobAppender);
this.flowLogger.error("Could not open log file in " + this.workingDir
+ " for job " + this.jobId, e);
}
if (this.azkabanProps.getBoolean(Constants.ConfigurationKeys.AZKABAN_LOGGING_KAFKA_ENABLED, false)) {
// Keep the names consistent as what we did in uploadLogFile()
this.kafkaLog4jAppender =
KafkaLog4jUtils.getAzkabanJobKafkaLog4jAppender(this.azkabanProps, this.loggerLayout,
String.valueOf(this.executionId), this.node.getNestedId(),
String.valueOf(this.node.getAttempt()));
if (this.kafkaLog4jAppender != null) {
this.logger.addAppender(this.kafkaLog4jAppender);
this.logger.setAdditivity(false);
this.flowLogger.info("Attached new Kafka appender for job " + this.jobId);
}
}
}
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
createLogger
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private void attachFileAppender(final FileAppender appender) {
// If present, remove the existing file appender
assert (this.jobAppender == null);
this.jobAppender = appender;
this.logger.addAppender(this.jobAppender);
this.logger.setAdditivity(false);
this.flowLogger.info("Attached file appender for job " + this.jobId);
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
attachFileAppender
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private FileAppender createFileAppender() throws IOException {
// Set up log files
final String logName = createLogFileName(this.node);
this.logFile = new File(this.workingDir, logName);
final String absolutePath = this.logFile.getAbsolutePath();
this.flowLogger.info("Log file path for job: " + this.jobId + " is: " + absolutePath);
// Attempt to create FileAppender
final RollingFileAppender fileAppender =
new RollingFileAppender(this.loggerLayout, absolutePath, true);
fileAppender.setMaxBackupIndex(this.jobLogBackupIndex);
fileAppender.setMaxFileSize(this.jobLogChunkSize);
this.flowLogger.info("Created file appender for job " + this.jobId);
return fileAppender;
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
createFileAppender
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private void createAttachmentFile() {
final String fileName = createAttachmentFileName(this.node);
final File file = new File(this.workingDir, fileName);
this.attachmentFileName = file.getAbsolutePath();
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
createAttachmentFile
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private void removeAppender(final Appender appender) {
if (appender != null) {
try {
this.logger.removeAppender(appender);
appender.close();
} catch (Exception e) {
logger.error("Failed to remove appender " + appender.getName(), e);
}
}
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
removeAppender
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private void closeLogger() {
removeAppender(this.jobAppender);
removeAppender(this.kafkaLog4jAppender);
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
closeLogger
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private void writeStatus() {
try {
this.node.setUpdateTime(System.currentTimeMillis());
this.executorLoader.updateExecutableNode(this.node);
} catch (final ExecutorManagerException e) {
this.flowLogger.error("Could not update job properties in db for "
+ this.jobId, e);
}
}
|
Returns a list of jobs that this JobRunner will wait upon to finish before starting. It is only
relevant if pipeline is turned on.
|
writeStatus
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private boolean handleNonReadyStatus() {
synchronized (this.syncObject) {
Status nodeStatus = this.node.getStatus();
boolean quickFinish = false;
final long time = System.currentTimeMillis();
if (Status.isStatusFinished(nodeStatus)) {
quickFinish = true;
} else if (nodeStatus == Status.DISABLED) {
changeStatus(Status.SKIPPED, time);
quickFinish = true;
} else if (this.isKilled()) {
changeStatus(Status.KILLED, time);
quickFinish = true;
}
if (quickFinish) {
this.node.setStartTime(time);
fireEvent(Event.create(this, EventType.JOB_STARTED, new EventData(node)));
this.node.setEndTime(time);
fireEvent(Event.create(this, EventType.JOB_FINISHED, new EventData(node)));
return true;
}
return false;
}
}
|
Used to handle non-ready and special status's (i.e. KILLED). Returns true if they handled
anything.
|
handleNonReadyStatus
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private boolean blockOnPipeLine() {
if (this.isKilled()) {
return true;
}
// For pipelining of jobs. Will watch other jobs.
if (!this.pipelineJobs.isEmpty()) {
String blockedList = "";
final ArrayList<BlockingStatus> blockingStatus =
new ArrayList<>();
for (final String waitingJobId : this.pipelineJobs) {
final Status status = this.watcher.peekStatus(waitingJobId);
if (status != null && !Status.isStatusFinished(status)) {
final BlockingStatus block = this.watcher.getBlockingStatus(waitingJobId);
blockingStatus.add(block);
blockedList += waitingJobId + ",";
}
}
if (!blockingStatus.isEmpty()) {
this.logger.info("Pipeline job " + this.jobId + " waiting on " + blockedList
+ " in execution " + this.watcher.getExecId());
for (final BlockingStatus bStatus : blockingStatus) {
this.logger.info("Waiting on pipelined job " + bStatus.getJobId());
this.currentBlockStatus = bStatus;
bStatus.blockOnFinishedStatus();
if (this.isKilled()) {
this.logger.info("Job was killed while waiting on pipeline. Quitting.");
return true;
} else {
this.logger.info("Pipelined job " + bStatus.getJobId() + " finished.");
}
}
}
}
this.currentBlockStatus = null;
return false;
}
|
If pipelining is set, will block on another flow's jobs.
|
blockOnPipeLine
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private boolean delayExecution() {
synchronized (this) {
if (this.isKilled()) {
return true;
}
final long currentTime = System.currentTimeMillis();
if (this.delayStartMs > 0) {
this.logger.info("Delaying start of execution for " + this.delayStartMs
+ " milliseconds.");
try {
this.wait(this.delayStartMs);
this.logger.info("Execution has been delayed for " + this.delayStartMs
+ " ms. Continuing with execution.");
} catch (final InterruptedException e) {
this.logger.error("Job " + this.jobId + " was to be delayed for "
+ this.delayStartMs + ". Interrupted after "
+ (System.currentTimeMillis() - currentTime));
}
if (this.isKilled()) {
this.logger.info("Job was killed while in delay. Quitting.");
return true;
}
}
}
return false;
}
|
If pipelining is set, will block on another flow's jobs.
|
delayExecution
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
private void finalizeLogFile(final int attemptNo) {
closeLogger();
this.flowLogger.debug("Logger has been closed");
if (this.logFile == null) {
this.flowLogger.info("Log file for job " + this.jobId + " is null");
return;
}
try {
final File[] files = this.logFile.getParentFile().listFiles(new FilenameFilter() {
@Override
public boolean accept(final File dir, final String name) {
return name.startsWith(JobRunner.this.logFile.getName());
}
});
Arrays.sort(files, Collections.reverseOrder());
this.executionLogsLoader.uploadLogFile(this.executionId, this.node.getNestedId(), attemptNo,
files);
} catch (final ExecutorManagerException e) {
this.flowLogger.error(
"Error writing out logs for job " + this.node.getNestedId(), e);
}
}
|
If pipelining is set, will block on another flow's jobs.
|
finalizeLogFile
|
java
|
azkaban/azkaban
|
azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.