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 sleep(final long milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (final InterruptedException e) {
logger.error("Sleep interrupted", e);
}
} | When database is completed down, DB connection fails to be fetched immediately. So we need
to sleep 15 seconds for retry. | sleep | java | azkaban/azkaban | azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java | https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java | Apache-2.0 |
@Override
public String getDBType() {
return "mysql";
} | When database is completed down, DB connection fails to be fetched immediately. So we need
to sleep 15 seconds for retry. | getDBType | java | azkaban/azkaban | azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java | https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java | Apache-2.0 |
@Override
public boolean allowsOnDuplicateKey() {
return true;
} | When database is completed down, DB connection fails to be fetched immediately. So we need
to sleep 15 seconds for retry. | allowsOnDuplicateKey | java | azkaban/azkaban | azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java | https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java | Apache-2.0 |
public static void writeJSON(final HttpServletResponse resp, final Object obj)
throws IOException {
resp.setContentType(JSON_MIME_TYPE);
final ObjectMapper mapper = new ObjectMapper();
final OutputStream stream = resp.getOutputStream();
mapper.writeValue(stream, obj);
} | Write an Object to HttpResponse in Json format.
@param resp
@param obj
@throws IOException | writeJSON | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/common/ServletUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/common/ServletUtils.java | Apache-2.0 |
public static Path getCurrentDir() {
// AZ_HOME must provide a correct path, if not then azHome is set to current working dir.
final String azHome = Optional.ofNullable(System.getenv(Constants.AZ_HOME)).orElse("");
return Paths.get(azHome).toAbsolutePath();
} | FlowPreparer implementation for containerized execution.
It creates the PROJECT_DIR and downloads and unzips the project zip in it thus READYing it
for execution. | getCurrentDir | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/ContainerizedFlowPreparer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/ContainerizedFlowPreparer.java | Apache-2.0 |
@Override
public void setup(final ExecutableFlow flow) throws ExecutorManagerException {
final ProjectDirectoryMetadata projectDirMetadata = new ProjectDirectoryMetadata(
flow.getProjectId(),
flow.getVersion(),
flow.getProjectName());
final long flowPrepStartTime = System.c... | Prepare the directory for flow execution.
@param flow Executable Flow instance. | setup | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/ContainerizedFlowPreparer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/ContainerizedFlowPreparer.java | Apache-2.0 |
@Override
protected File setupExecutionDir(final Path dir, final ExecutableFlow flow)
throws ExecutorManagerException {
// Create project dir
final Path projectDirPath = Paths.get(dir.toString(), PROJECT_DIR);
// A directory of name projectDirPath cannot pre-exist.
if (Files.exists(projectDi... | Prepare the directory for flow execution.
@param flow Executable Flow instance. | setupExecutionDir | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/ContainerizedFlowPreparer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/ContainerizedFlowPreparer.java | Apache-2.0 |
@VisibleForTesting
void handleModifyExecutionRequest(final Map<String, Object> respMap, final int execId,
final String user, final HttpServletRequest req) throws ServletException {
if (user == null) {
respMap.put(ConnectorParams.RESPONSE_ERROR, "user has not been set");
return;
}
if (!h... | This method checks if the modifyExecution request also has param modifyType with value
retryFailures, then it attempts to retry the failed jobs in the running execution.
@param respMap
@param execId
@param user
@param req
@throws ServletException | handleModifyExecutionRequest | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/ContainerServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/ContainerServlet.java | Apache-2.0 |
@VisibleForTesting
void handlePing(HashMap<String, Object> respMap) {
respMap.put(ConnectorParams.STATUS_PARAM, ConnectorParams.RESPONSE_ALIVE);
} | This method checks if the modifyExecution request also has param modifyType with value
retryFailures, then it attempts to retry the failed jobs in the running execution.
@param respMap
@param execId
@param user
@param req
@throws ServletException | handlePing | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/ContainerServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/ContainerServlet.java | Apache-2.0 |
private void handleAjaxCancel(final Map<String, Object> respMap, final int execid,
final String user) {
if (user == null) {
respMap.put(ConnectorParams.RESPONSE_ERROR, "user has not been set");
return;
}
try {
this.flowContainer.cancelFlow(execid, user);
respMap.put(ConnectorP... | This method checks if the modifyExecution request also has param modifyType with value
retryFailures, then it attempts to retry the failed jobs in the running execution.
@param respMap
@param execId
@param user
@param req
@throws ServletException | handleAjaxCancel | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/ContainerServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/ContainerServlet.java | Apache-2.0 |
private void handleFetchLogEvent(final int execId, final HttpServletRequest req,
final HttpServletResponse resp, final Map<String, Object> respMap)
throws ServletException {
final String type = getParam(req, "type");
final int startByte = getIntParam(req, "offset");
final int length = getIntPara... | This method checks if the modifyExecution request also has param modifyType with value
retryFailures, then it attempts to retry the failed jobs in the running execution.
@param respMap
@param execId
@param user
@param req
@throws ServletException | handleFetchLogEvent | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/ContainerServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/ContainerServlet.java | Apache-2.0 |
private void handleFetchMetaDataEvent(final int execId, final HttpServletRequest req,
final HttpServletResponse resp, final Map<String, Object> respMap)
throws ServletException {
final int startByte = getIntParam(req, "offset");
final int length = getIntParam(req, "length");
resp.setContentType... | This method checks if the modifyExecution request also has param modifyType with value
retryFailures, then it attempts to retry the failed jobs in the running execution.
@param respMap
@param execId
@param user
@param req
@throws ServletException | handleFetchMetaDataEvent | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/ContainerServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/ContainerServlet.java | Apache-2.0 |
private static Props setAzkabanProps(final Path jobtypePluginPath) {
final Map<String, String> propsMap = new HashMap<>();
propsMap.put(AzkabanExecutorServer.JOBTYPE_PLUGIN_DIR,
jobtypePluginPath.toString());
// Setup the azkaban.properties here.
final String[] args = {CONF_ARG, CONF_DIR};
... | Set Azkaban Props
@param jobtypePluginPath Path where all the jobtype plugins are mounted.
@return Populated Azkaban properties. | setAzkabanProps | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
@VisibleForTesting
static void setInjector(final Props azkabanProps) {
// Inject AzkabanCommonModule
final Injector injector = Guice.createInjector(
new AzkabanCommonModule(azkabanProps),
new ClusterModule(),
new ExecJettyServerModule()
);
SERVICE_PROVIDER.setInjector(injector)... | Set Azkaban Props
@param jobtypePluginPath Path where all the jobtype plugins are mounted.
@return Populated Azkaban properties. | setInjector | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
@VisibleForTesting
void setResourceUtilization() {
final FlowRunnerProxy flowRunnerProxy = this.flowRunner.getProxy();
final String cpuRequest = System
.getenv(Constants.ContainerizedDispatchManagerProperties.ENV_CPU_REQUEST);
final String memoryRequest = System
.getenv(Constants.Container... | This method reads the CPU and MEMORY REQUEST ENV variables. If they are present then they will
be used to set the Resource Utilization in FlowRunner object via FlowRunnerProxy. | setResourceUtilization | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
private void createFlowRunner(final ExecutableFlow flow) throws ExecutorManagerException {
// Prepare the flow with project dependencies.
this.flowPreparer.setup(flow);
// Setup flow watcher
FlowWatcher watcher = null;
final ExecutionOptions options = flow.getExecutionOptions();
if (options.get... | Create Flow Runner and setup the flow execution directory with project dependencies.
@param flow Executable flow object.
@return FlowRunner object.
@throws ExecutorManagerException | createFlowRunner | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
private void setupKeyStore() throws ExecutorManagerException {
// Fetch keyStore props and use it to get the KeyStore, put it in JobTypeManager
final Props commonPluginLoadProps = this.jobTypeManager.getCommonPluginLoadProps();
if (commonPluginLoadProps != null) {
// Load HadoopSecurityManager
H... | Setup in-memory keystore to be reused for all the job executions in the flow.
@throws ExecutorManagerException | setupKeyStore | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
@VisibleForTesting
void start() {
AzkabanServer.setupTimeZone(this.azkabanProps, logger);
this.containerContext.setAttribute(Constants.AZKABAN_CONTAINER_CONTEXT_KEY, this);
JmxJobMBeanManager.getInstance().initialize(this.azkabanProps);
ServerUtils.configureJobCallback(FlowContainer.logger, this.azka... | Starts the Jetty Server and sets up callback mechanisms | start | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
@Override
public void pauseFlow(int execId, String user) throws ExecutorManagerException {
throw new NotImplementedException("Operation not yet implemented.");
} | Starts the Jetty Server and sets up callback mechanisms | pauseFlow | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
@Override
public void resumeFlow(int execId, String user) throws ExecutorManagerException {
throw new NotImplementedException("Operation not yet implemented.");
} | Starts the Jetty Server and sets up callback mechanisms | resumeFlow | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
@Override
public void cancelFlow(final int execId, final String user)
throws ExecutorManagerException {
logger.info("Cancel Flow called");
if (this.flowRunner == null) {
logger.warn(String.format("Attempt to cancel flow execId: %d before flow got a chance to start.",
execId));
thr... | Starts the Jetty Server and sets up callback mechanisms | cancelFlow | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
@Override
public void cancelJobBySLA(final int execId, final String jobId)
throws ExecutorManagerException {
if (this.flowRunner == null) {
throw new ExecutorManagerException("Execution " + execId + " is not running.");
}
this.flowRunner.getExecutableFlow().setModifiedBy("SLA");
for (fin... | Starts the Jetty Server and sets up callback mechanisms | cancelJobBySLA | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
@Override
public void retryFailures(final int execId, final String user)
throws ExecutorManagerException {
if (this.flowRunner == null) {
logger.warn(String.format("Attempt to retry failures for execId: %d before flow got a "
+ "chance to start.", execId));
throw new ExecutorManagerEx... | Starts the Jetty Server and sets up callback mechanisms | retryFailures | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
public LogData readFlowLogs(final int execId, final int startByte, final int length)
throws ExecutorManagerException {
logger.info("readFlowLogs called");
if (this.flowRunner == null) {
logger.warn(String.format("Attempt to read flow logs before flow execId: %d got a chance to start",
exec... | Return accumulated flow logs with the specified length from the flow container starting from
the given byte offset.
@param execId
@param startByte
@param length
@return
@throws ExecutorManagerException | readFlowLogs | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
public LogData readJobLogs(final int execId, final String jobId, final int attempt,
final int startByte, final int length) throws ExecutorManagerException {
logger.info("readJobLogs called");
if (this.flowRunner == null) {
logger.warn(String.format("Attempt to read job logs before flow got a chance... | Return accumulated job logs for a specific job starting with the provided byte offset.
@param execId
@param jobId
@param attempt
@param startByte
@param length
@return
@throws ExecutorManagerException | readJobLogs | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
public JobMetaData readJobMetaData(final int execId, final String jobId,
final int attempt, final int startByte, final int length) throws ExecutorManagerException {
logger.info("readJobMetaData called");
if (this.flowRunner == null) {
logger.warn(String.format("Metadata cannot be read as flow has n... | @param execId
@param jobId
@param attempt
@param startByte
@param length
@return
@throws ExecutorManagerException | readJobMetaData | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
@VisibleForTesting
static void launchCtrlMsgListener(final FlowContainer flowContainer) {
try {
flowContainer.jettyServer.start();
} catch (final Exception e) {
logger.error(e.getMessage());
}
final Connector[] connectors = flowContainer.jettyServer.getConnectors();
checkState(connect... | @param execId
@param jobId
@param attempt
@param startByte
@param length
@return
@throws ExecutorManagerException | launchCtrlMsgListener | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
private static int getExecutionId() throws ExecutorManagerException {
final String execIdStr = System.getenv(
Constants.ContainerizedDispatchManagerProperties.ENV_FLOW_EXECUTION_ID);
if (execIdStr == null) {
final String msg = "Execution ID is not set!";
logger.error(msg);
throw new Ex... | @param execId
@param jobId
@param attempt
@param startByte
@param length
@return
@throws ExecutorManagerException | getExecutionId | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
private void logVersionSet(final ExecutableFlow flow) {
final VersionSet versionSet = flow.getVersionSet();
if (versionSet == null) {
// Should not happen.
logger.error("VersionSet is not set for the flow");
} else {
logger.info("VersionSet: " + ServerUtils.getVersionSetJsonString(versionS... | Log the versionSet for this flow execution
@param flow Executable flow. | logVersionSet | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
private void logVPAEnabled(final ExecutableFlow flow) {
if (flow.isVPAEnabled()) {
logger.info(String.format("This flow execution pod %s is autoscaled by Azkaban. If this "
+ "execution ends with Out-Of-Memory Killed, please reach out to Azkaban team for "
+ "help.", flow.getExecut... | Log if this flow execution pod is autoscaled by VPA
@param flow Executable flow. | logVPAEnabled | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
public static void deleteSymlinkedFile(final Path symlinkedFilePath)
throws ExecutorManagerException {
if (Files.isSymbolicLink(symlinkedFilePath)) {
Path filePath = null;
try {
filePath = Files.readSymbolicLink(symlinkedFilePath);
} catch (final IOException e) {
logger.error... | Deletes all the symlinks and targeted files recursively.
@param symlinkedFilePath Path to file, could be a symlink
@throws ExecutorManagerException | deleteSymlinkedFile | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
private void createLogger() {
final Logger rootLogger = Logger.getRootLogger();
for (Object o: Collections.list(rootLogger.getAllAppenders())) {
if (o instanceof FileAppender) {
final FileAppender appender = (FileAppender) o;
logFile = new File(appender.getFile());
break;
}
... | setup logger and execution dir for the flowId | createLogger | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
private static void removeAppender(final Appender appender) {
final Logger rootLogger = Logger.getRootLogger();
if (appender != null) {
try {
rootLogger.removeAppender(appender);
appender.close();
} catch (Exception e) {
logger.error("Failed to remove appender " + appender.ge... | setup logger and execution dir for the flowId | removeAppender | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
private void closeLogger() {
// If fileAppender is created internally, we should remove it. Otherwise, its lifecycle will be
// managed by log4j framework.
removeAppender(this.fileAppender);
removeAppender(this.kafkaLog4jAppender);
try {
this.executionLogsLoader.uploadLogFile(this.execId, "", ... | setup logger and execution dir for the flowId | closeLogger | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
@VisibleForTesting
void shutdown() {
logger.info("Shutting down the container");
if (this.flowRunner != null) {
while (!this.flowFuture.isDone()) {
// This should not happen immediately as submitFlowRunner is a blocking call.
try {
Thread.sleep(100);
} catch (final Inte... | Shutdown the Container. This shuts down the ExecutorService which runs the flow execution as
well as JettyServer. | shutdown | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java | Apache-2.0 |
void addNode(final Node node) {
assert (node.getDag() == this);
this.nodes.add(node);
} | Adds a node to the current dag.
<p>It's important NOT to expose this method as public. The design relies on this to ensure
correctness. The DAG's structure shouldn't change after it is created.
<p>The DagBuilder will check that node names are unique within a dag. No check is necessary
here since the method package pr... | addNode | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
void start() {
assert (this.status == Status.READY);
changeStatus(Status.RUNNING);
for (final Node node : this.nodes) {
node.runIfAllowed();
}
// It's possible that all nodes are disabled. In this rare case the dag should be
// marked success. Otherwise it will be stuck in the the running ... | Adds a node to the current dag.
<p>It's important NOT to expose this method as public. The design relies on this to ensure
correctness. The DAG's structure shouldn't change after it is created.
<p>The DagBuilder will check that node names are unique within a dag. No check is necessary
here since the method package pr... | start | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
void kill() {
if (this.status.isTerminal() || this.status == Status.KILLING) {
// It is possible that a kill is issued after a dag has finished or multiple kill requests
// are received. Without this check, this method will make duplicate calls to the
// DagProcessor.
return;
}
chang... | Adds a node to the current dag.
<p>It's important NOT to expose this method as public. The design relies on this to ensure
correctness. The DAG's structure shouldn't change after it is created.
<p>The DagBuilder will check that node names are unique within a dag. No check is necessary
here since the method package pr... | kill | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
void updateDagStatus() {
// A dag may have nodes that are disabled. It's safer to scan all the nodes.
// Assume the overhead is minimal. If it is not the case, we can optimize later.
boolean failed = false;
for (final Node node : this.nodes) {
final Status nodeStatus = node.getStatus();
if (... | Update the final dag status when all nodes are done.
<p>If any node has not reached its terminal state, this method will simply return. | updateDagStatus | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
private void updateDagStatusInternal(final boolean failed) {
if (this.status == Status.KILLING) {
/*
It's possible that some nodes have failed when the dag is killed.
Since killing a dag signals an intent from an operator, it is more important to make
the dag status reflect the result of tha... | Update the final dag status.
@param failed true if any of the jobs has failed | updateDagStatusInternal | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
private void changeStatus(final Status status) {
this.status = status;
this.dagProcessor.changeStatus(this, status);
} | Update the final dag status.
@param failed true if any of the jobs has failed | changeStatus | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
@Override
public String toString() {
return String.format("dag (%s), status (%s)", this.name, this.status);
} | Update the final dag status.
@param failed true if any of the jobs has failed | toString | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
String getName() {
return this.name;
} | Update the final dag status.
@param failed true if any of the jobs has failed | getName | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
Status getStatus() {
return this.status;
} | Update the final dag status.
@param failed true if any of the jobs has failed | getStatus | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
@VisibleForTesting
void setStatus(final Status status) {
this.status = status;
} | Update the final dag status.
@param failed true if any of the jobs has failed | setStatus | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
@VisibleForTesting
public List<Node> getNodes() {
return this.nodes;
} | Update the final dag status.
@param failed true if any of the jobs has failed | getNodes | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Dag.java | Apache-2.0 |
public Node createNode(final String name, final NodeProcessor nodeProcessor) {
checkIsBuilt();
if (this.nameToNodeMap.get(name) != null) {
throw new DagException(String.format("Node names in %s need to be unique. The name "
+ "(%s) already exists.", this, name));
}
final Node node = new... | Creates a new node and adds it to the DagBuilder.
@param name name of the node
@param nodeProcessor node processor associated with this node
@return a new node
@throws DagException if the name is not unique in the DAG. | createNode | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | Apache-2.0 |
private void checkIsBuilt() {
if (this.isBuilt) {
final String msg = String
.format("The DAG (%s) is built already. Can't create new nodes.", this);
throw new DagException(msg);
}
} | Throws an exception if the {@link DagBuilder#build()} method has been called. | checkIsBuilt | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | Apache-2.0 |
public void addParentNode(final String childNodeName, final String parentNodeName) {
checkIsBuilt();
final Node child = this.nameToNodeMap.get(childNodeName);
if (child == null) {
throw new DagException(String.format("Unknown child node (%s). Did you create the node?",
childNodeName));
... | Add a parent node to a child node. All the names should have been registered with this builder
with the {@link DagBuilder#createNode(String, NodeProcessor)} call.
@param childNodeName name of the child node
@param parentNodeName name of the parent node | addParentNode | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | Apache-2.0 |
public Dag build() {
checkIsBuilt();
checkCircularDependencies();
this.isBuilt = true;
return this.dag;
} | Builds the dag.
<p>Once this method is called, subsequent calls via NodeBuilder to modify the nodes's
relationships in the dag will have no effect on the returned Dag object.
</p>
@return the Dag reflecting the current state of the DagBuilder | build | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | Apache-2.0 |
private void checkCircularDependencies() {
class CircularDependencyChecker {
// The nodes that need to be visited
private final Set<Node> toVisit = new HashSet<>(DagBuilder.this.nameToNodeMap.values());
// The nodes that have finished traversing all their parent nodes
private final Set<Nod... | Checks if the builder contains nodes that form a circular dependency ring.
<p>The depth first algorithm is described in this article
<a href="https://en.wikipedia.org/wiki/Topological_sorting">https://en.wikipedia.org/wiki/Topological_sorting</a>
</p>
@throws DagException if true | checkCircularDependencies | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | Apache-2.0 |
private void check() {
while (!this.toVisit.isEmpty()) {
final Node node = removeOneNodeFromToVisitSet();
if (checkNode(node)) {
final String msg = String.format("Circular dependency detected. Sample: %s",
this.sampleCircularNodes);
throw new DagExcept... | Checks if the builder contains nodes that form a circular dependency ring.
@throws DagException if true | check | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | Apache-2.0 |
private Node removeOneNodeFromToVisitSet() {
final Iterator<Node> iterator = this.toVisit.iterator();
final Node node = iterator.next();
iterator.remove();
return node;
} | Removes one node from the toVisit set and returns that node.
@return a node | removeOneNodeFromToVisitSet | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | Apache-2.0 |
private boolean checkNode(final Node node) {
if (this.finished.contains(node)) {
return false;
}
if (this.ongoing.contains(node)) {
this.sampleCircularNodes.add(node);
return true;
}
this.toVisit.remove(node);
this.ongoing.add(node);
... | Checks if the node is part of a group of nodes that form a circular dependency ring.
<p>If true, the node will be added to the sampleCircularNodes list</p>
@param node node to check
@return true if it is | checkNode | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | Apache-2.0 |
@Override
public String toString() {
return String.format("DagBuilder (%s)", this.dag.getName());
} | Checks if the node is part of a group of nodes that form a circular dependency ring.
<p>If true, the node will be added to the sampleCircularNodes list</p>
@param node node to check
@return true if it is | toString | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java | Apache-2.0 |
public void shutdownAndAwaitTermination() throws InterruptedException {
logger.info("DagService is shutting down.");
this.executorServiceUtils.gracefulShutdown(this.executorService, SHUTDOWN_WAIT_TIMEOUT);
} | Shuts down the service and waits for the tasks to finish. | shutdownAndAwaitTermination | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagService.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagService.java | Apache-2.0 |
@VisibleForTesting
ExecutorService getExecutorService() {
return this.executorService;
} | Shuts down the service and waits for the tasks to finish. | getExecutorService | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/DagService.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/DagService.java | Apache-2.0 |
Dag getDag() {
return this.dag;
} | Node in a DAG: Directed acyclic graph. | getDag | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
void addParent(final Node node) {
this.parents.add(node);
node.addChild(this);
} | Adds the node as the current node's parent i.e. the current node depends on the given node.
<p>It's important NOT to expose this method as public. The design relies on this to ensure
correctness. The DAG's structure shouldn't change after it is created. | addParent | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
boolean hasParent() {
return !this.parents.isEmpty();
} | Adds the node as the current node's parent i.e. the current node depends on the given node.
<p>It's important NOT to expose this method as public. The design relies on this to ensure
correctness. The DAG's structure shouldn't change after it is created. | hasParent | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
private boolean isReady() {
if (this.status != Status.READY) {
// e.g. if the node is disabled, it is not ready to run.
return false;
}
for (final Node parent : this.parents) {
if (!parent.status.isSuccessEffectively()) {
return false;
}
}
return true;
} | Checks if the node is ready to run.
@return true if the node is ready to run | isReady | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
void markSuccess() {
// It's possible that the dag is killed before this method is called.
assertRunningOrKilling();
changeStatus(Status.SUCCESS);
for (final Node child : this.children) {
child.runIfAllowed();
}
this.dag.updateDagStatus();
} | Transitions the node to the success state. | markSuccess | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
void runIfAllowed() {
if (isReady()) {
changeStatus(Status.RUNNING);
}
} | Checks if all the dependencies are met and run if they are. | runIfAllowed | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
void markFailed() {
// It's possible that the dag is killed before this method is called.
assertRunningOrKilling();
changeStatus(Status.FAILURE);
for (final Node child : this.children) {
child.cancel();
}
//todo: HappyRay support failure options "Finish Current Running" and "Cancel All"
... | Transitions the node to the failure state. | markFailed | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
private void cancel() {
// The node shouldn't have started.
assert (this.status.isPreRunState());
if (this.status != Status.DISABLED) {
changeStatus(Status.CANCELED);
}
for (final Node node : this.children) {
node.cancel();
}
} | Transitions the node to the failure state. | cancel | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
private void assertRunningOrKilling() {
assert (this.status == Status.RUNNING || this.status == Status.KILLING);
} | Asserts that the state is running or killing. | assertRunningOrKilling | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
private void changeStatus(final Status status) {
this.status = status;
this.nodeProcessor.changeStatus(this, this.status);
} | Asserts that the state is running or killing. | changeStatus | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
void kill() {
assert (this.dag.getStatus() == Status.KILLING);
if (this.status == Status.READY || this.status == Status.BLOCKED) {
// If the node is disabled, keep the status as disabled.
changeStatus(Status.CANCELED);
} else if (this.status == Status.RUNNING) {
changeStatus(Status.KILLING... | Kills a node.
<p>A node is not designed to be killed individually. This method expects {@link Dag#kill()}
method to kill all nodes. Thus this method itself doesn't need to propagate the kill signal to
the node's children nodes. | kill | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
void markKilled() {
assert (this.status == Status.KILLING);
changeStatus(Status.KILLED);
this.dag.updateDagStatus();
} | Transition the node from the killing state to the killed state. | markKilled | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
@Override
public String toString() {
return String.format("Node (%s) status (%s) in %s", this.name, this.status, this.dag);
} | Transition the node from the killing state to the killed state. | toString | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
Status getStatus() {
return this.status;
} | Transition the node from the killing state to the killed state. | getStatus | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
@VisibleForTesting
void setStatus(final Status status) {
this.status = status;
} | Transition the node from the killing state to the killed state. | setStatus | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
String getName() {
return this.name;
} | Transition the node from the killing state to the killed state. | getName | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
@VisibleForTesting
List<Node> getChildren() {
return this.children;
} | Transition the node from the killing state to the killed state. | getChildren | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
@VisibleForTesting
List<Node> getParents() {
return this.parents;
} | Transition the node from the killing state to the killed state. | getParents | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/dag/Node.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/dag/Node.java | Apache-2.0 |
static long calculateDirSizeAndSave(final File dir) throws IOException {
final Path path = Paths.get(dir.getPath(), AbstractFlowPreparer.PROJECT_DIR_SIZE_FILE_NAME);
if (!Files.exists(path)) {
final long sizeInByte = FileUtils.sizeOfDirectory(dir);
FileIOUtils.dumpNumberToFile(path, sizeInByte);
... | Calculate the directory size and save it to a file.
@param dir the directory whose size needs to be saved.
@return the size of the dir. | calculateDirSizeAndSave | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AbstractFlowPreparer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AbstractFlowPreparer.java | Apache-2.0 |
@VisibleForTesting
public void downloadAndUnzipProject(final ProjectDirectoryMetadata proj, final int execId,
final File dest) throws IOException {
final long start = System.currentTimeMillis();
final ProjectFileHandler projectFileHandler = requireNonNull(this.projectStorageManager
.getProje... | Calculate the directory size and save it to a file.
@param dir the directory whose size needs to be saved.
@return the size of the dir. | downloadAndUnzipProject | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AbstractFlowPreparer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AbstractFlowPreparer.java | Apache-2.0 |
private void downloadAllDependencies(final ProjectDirectoryMetadata proj, final int execId,
final File folder, final Set<Dependency> dependencies) {
// Download all of the dependencies from storage
LOGGER.info("Downloading {} JAR dependencies... Project: {}, ExecId: {}",
dependencies.size(), p... | Download necessary JAR dependencies from storage
@param proj project to download
@param execId execution id number
@param folder root of unzipped project
@param dependencies the set of dependencies to download | downloadAllDependencies | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AbstractFlowPreparer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AbstractFlowPreparer.java | Apache-2.0 |
@Override
protected void configure() {
install(new ExecJettyServerModule());
install(new ClusterModule());
} | This Guice module is currently a one place container for all bindings in the current module. This
is intended to help during the migration process to Guice. Once this class starts growing we can
move towards more modular structuring of Guice components. | configure | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecServerModule.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecServerModule.java | Apache-2.0 |
public static AzkabanExecutorServer getApp() {
return app;
} | Returns the currently executing executor server, if one exists. | getApp | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | Apache-2.0 |
private void configureMetricReports() throws MetricException {
final Props props = getAzkabanProps();
if (props != null && props.getBoolean("executor.metric.reports", false)) {
logger.info("Starting to configure Metric Reports");
final MetricReportManager metricManager = MetricReportManager.getInsta... | Configure Metric Reporting as per azkaban.properties settings | configureMetricReports | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | Apache-2.0 |
private void loadCustomJMXAttributeProcessor(final Props props) {
final String jmxAttributeEmitter =
props.get(CUSTOM_JMX_ATTRIBUTE_PROCESSOR_PROPERTY);
if (jmxAttributeEmitter != null) {
try {
logger.info("jmxAttributeEmitter: " + jmxAttributeEmitter);
final Constructor<Props>[] c... | Load a custom class, which is provided by a configuration CUSTOM_JMX_ATTRIBUTE_PROCESSOR_PROPERTY.
<p>
This method will try to instantiate an instance of this custom class and with given properties
as the argument in the constructor.
<p>
Basically the custom class must have a constructor that takes an argument with typ... | loadCustomJMXAttributeProcessor | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | Apache-2.0 |
public ExecutorLoader getExecutorLoader() {
return this.executionLoader;
} | Load a custom class, which is provided by a configuration CUSTOM_JMX_ATTRIBUTE_PROCESSOR_PROPERTY.
<p>
This method will try to instantiate an instance of this custom class and with given properties
as the argument in the constructor.
<p>
Basically the custom class must have a constructor that takes an argument with typ... | getExecutorLoader | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | Apache-2.0 |
public int getPort() {
final Connector[] connectors = this.server.getConnectors();
checkState(connectors.length >= 1, "Server must have at least 1 connector");
// The first connector is created upon initializing the server. That's the one that has the port.
return connectors[0].getLocalPort();
} | Get the current server port
@return the port at which the executor server is running | getPort | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | Apache-2.0 |
public String getExecutorHostPort() {
return getHost() + ":" + getPort();
} | Returns host:port combination for currently running executor | getExecutorHostPort | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | Apache-2.0 |
private void sleep(final Duration duration) {
try {
Thread.sleep(duration.toMillis());
} catch (final InterruptedException e) {
logger.error(e);
}
} | Returns host:port combination for currently running executor | sleep | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | Apache-2.0 |
public void shutdown() {
logger.warn("Shutting down AzkabanExecutorServer...");
new Thread(() -> {
// Hack: Sleep for a little time to allow API calls to complete
sleep(Duration.ofSeconds(2));
shutdownInternal();
}, "shutdown").start();
} | Shutdown the server. - performs a safe shutdown. Waits for completion of current tasks - spawns
a shutdown thread and returns immediately. | shutdown | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | Apache-2.0 |
private void shutdownInternal() {
getFlowRampManager().shutdown();
getFlowRunnerManager().shutdown();
// Sleep for an hour to wait for web server updater thread
// {@link azkaban.executor.RunningExecutionsUpdaterThread#updateExecutions} to finalize updating
sleep(Duration.ofHours(1));
// trigger... | (internal API) Note: This should be run in a separate thread.
<p>
Shutdown the server. (blocking call) - waits for jobs to finish - doesn't accept any new jobs | shutdownInternal | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/AzkabanExecutorServer.java | Apache-2.0 |
ProjectCacheHitRatio getProjectCacheHitRatio() {
return this.projectCacheHitRatio;
} | This class ExecMetrics is in charge of collecting metrics from executors. | getProjectCacheHitRatio | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecMetrics.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecMetrics.java | Apache-2.0 |
public void addFlowRunnerManagerMetrics(final FlowRunnerManager flowRunnerManager) {
this.metricsManager
.addGauge(NUM_RUNNING_FLOWS_NAME, flowRunnerManager::getNumRunningFlows);
this.metricsManager
.addGauge(NUM_QUEUED_FLOWS_NAME, flowRunnerManager::getNumQueuedFlows);
} | This class ExecMetrics is in charge of collecting metrics from executors. | addFlowRunnerManagerMetrics | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecMetrics.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecMetrics.java | Apache-2.0 |
public Timer.Context getFlowSetupTimerContext() {
return this.flowSetupTimer.time();
} | @return the {@link Timer.Context} for the timer. | getFlowSetupTimerContext | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecMetrics.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecMetrics.java | Apache-2.0 |
public Timer.Context getFlowStartupDelayTimerContext() {
return this.flowStartupDelayTimer.time();
} | @return the {@link Timer.Context} for the flow-startup-delay timer. | getFlowStartupDelayTimerContext | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecMetrics.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecMetrics.java | Apache-2.0 |
@Deprecated
@Override
public void doGet(final HttpServletRequest req, final HttpServletResponse resp)
throws IOException {
handleRequest(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/ExecutorServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | Apache-2.0 |
@Override
public void doPost(final HttpServletRequest req, final HttpServletResponse resp)
throws IOException {
handleRequest(req, resp);
} | @deprecated GET available for seamless upgrade. azkaban-web now uses POST. | doPost | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | Apache-2.0 |
public void handleRequest(final HttpServletRequest req, final HttpServletResponse resp)
throws IOException {
final HashMap<String, Object> respMap = new HashMap<>();
try {
if (!hasParam(req, ConnectorParams.ACTION_PARAM)) {
logger.error("Parameter action not set");
respMap.put("error... | @deprecated GET available for seamless upgrade. azkaban-web now uses POST. | handleRequest | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | Apache-2.0 |
private void handleModifyProperty(@Nullable final String propName,
@Nullable final String propValue, final HashMap<String, Object> respMap)
throws ServletException {
if (propName == null || propValue == null) {
String errMsg =
String.format("Both %s and %s need to be provided for action ... | @deprecated GET available for seamless upgrade. azkaban-web now uses POST. | handleModifyProperty | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | Apache-2.0 |
private void modifyPollingInterval(@Nonnull final String newPollingIntervalMillis,
final HashMap<String, Object> respMap) {
int pollingIntervalMillis = 0;
boolean isValidValue = false;
try {
pollingIntervalMillis = Integer.parseUnsignedInt(newPollingIntervalMillis);
isValidValue = (pollin... | Modifies the time interval at which the executor is polling the queue for unassigned jobs, and
assigning a job(s) to itself.
@param newPollingIntervalMillis The desired polling interval. It needs to be a positive
integer (milliseconds) in String format.
@param respMap The response map. | modifyPollingInterval | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | Apache-2.0 |
private void handleModifyExecutionRequest(final Map<String, Object> respMap,
final int execId, final String user, final HttpServletRequest req) throws ServletException {
if (!hasParam(req, ConnectorParams.MODIFY_EXECUTION_ACTION_TYPE)) {
respMap.put(ConnectorParams.RESPONSE_ERROR, "Modification type not... | Modifies the time interval at which the executor is polling the queue for unassigned jobs, and
assigning a job(s) to itself.
@param newPollingIntervalMillis The desired polling interval. It needs to be a positive
integer (milliseconds) in String format.
@param respMap The response map. | handleModifyExecutionRequest | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | Apache-2.0 |
private void handleFetchLogEvent(final int execId, final HttpServletRequest req,
final HttpServletResponse resp, final Map<String, Object> respMap)
throws ServletException {
final String type = getParam(req, "type");
final int startByte = getIntParam(req, "offset");
final int length = getIntPara... | Modifies the time interval at which the executor is polling the queue for unassigned jobs, and
assigning a job(s) to itself.
@param newPollingIntervalMillis The desired polling interval. It needs to be a positive
integer (milliseconds) in String format.
@param respMap The response map. | handleFetchLogEvent | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | Apache-2.0 |
private void handleFetchAttachmentsEvent(final int execId, final HttpServletRequest req,
final HttpServletResponse resp, final Map<String, Object> respMap)
throws ServletException {
final String jobId = getParam(req, "jobId");
final int attempt = getIntParam(req, "attempt", 0);
try {
fina... | Modifies the time interval at which the executor is polling the queue for unassigned jobs, and
assigning a job(s) to itself.
@param newPollingIntervalMillis The desired polling interval. It needs to be a positive
integer (milliseconds) in String format.
@param respMap The response map. | handleFetchAttachmentsEvent | java | azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-exec-server/src/main/java/azkaban/execapp/ExecutorServlet.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.