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 deleteContainerQuietly(final int executionId) {
try {
this.containerizedImpl.deleteContainer(executionId);
} catch (final Exception e) {
logger.error("Unexpected exception while deleting container.", e);
}
} | Quietly retry flow if it is terminated in statuses prior to RUNNING
@param flow
@param originalStatus | deleteContainerQuietly | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerCleanupManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerCleanupManager.java | Apache-2.0 |
@SuppressWarnings("FutureReturnValueIgnored")
public void start() {
logger.info("Start container cleanup service");
// Default execution clean up interval is 10 min, container clean up interval is 60 min
this.cleanupService.scheduleAtFixedRate(this::cleanUpStaleFlows, 0L,
this.executionCleanupInte... | Start periodic deletions of per-container resources for stale executions. | start | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerCleanupManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerCleanupManager.java | Apache-2.0 |
public void reloadFlowFilter() {
// Reset the filter map
loadFlowFilter(new HashMap<>());
} | Reloads the in-memory flows map with the flow filter file. | reloadFlowFilter | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | Apache-2.0 |
@VisibleForTesting
public void reloadFlowFilter(final String fileLocation) {
// Reset the filter map
loadFlowFilter(new HashMap<>(), fileLocation);
} | Reloads the in-memory flows map with the flow filter file. | reloadFlowFilter | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | Apache-2.0 |
private void loadFlowFilter(final Map<String, Set<String >> flowMap) {
loadFlowFilter(flowMap, this.fileLocation);
} | Reloads the in-memory flows map with the flow filter file. | loadFlowFilter | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | Apache-2.0 |
private void loadFlowFilter(final Map<String, Set<String>> flowMap, final String fileLocation) {
// Basic checks
if (fileLocation == null) {
return;
}
final Path filePath = Paths.get(fileLocation);
if (Files.notExists(filePath) || !Files.isReadable(filePath)) {
logger.info("Flow filter f... | Read the flow filter file and create a map of flow names. The read happens
on best effort basis. i.e, if a flow name is not correctly formatted, it
is ignored. | loadFlowFilter | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | Apache-2.0 |
private void validateAndAdd(final List<String> flowFQN, final Map<String, Set<String>> flowMap) {
if (!(flowFQN.size() == 1 || flowFQN.size() == 2)) {
return;
}
final String project = flowFQN.get(0);
if (flowFQN.size() == 1) {
// Entire project is in the filter.
flowMap.put(project, n... | Validate flowFQN and add it to flows map.
@param flowFQN stored in the file is of format:
<project name> when entire project needs to be in the filter and
<project name>:<flow name>. | validateAndAdd | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | Apache-2.0 |
public DispatchMethod getDispatchMethod(final ExecutableFlow flow) {
return flowExists(flow.getProjectName(), flow.getFlowId()) ?
DispatchMethod.POLL : DispatchMethod.CONTAINERIZED;
} | If the flow exists in the flow filter, then return POLL,
else return CONTAINERIZED.
@param flow executable flow object.
@return DispatchMethod. | getDispatchMethod | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | Apache-2.0 |
@VisibleForTesting
public boolean flowExists(final String projectName, final String flowName) {
if (!this.flows.containsKey(projectName)) {
return false;
}
final Set<String> flowNames = this.flows.get(projectName);
return flowNames == null || flowNames.contains(flowName);
} | If the flow exists in the flow filter, then return POLL,
else return CONTAINERIZED.
@param flow executable flow object.
@return DispatchMethod. | flowExists | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerFlowCriteria.java | Apache-2.0 |
public static TreeSet<String> getJobTypesForFlow(final ExecutableFlow flow) {
final TreeSet<String> jobTypes = new TreeSet<>();
populateJobTypeForFlow(flow, jobTypes);
return jobTypes;
} | This method is used to get jobTypes for a flow. This method is going to call
populateJobTypeForFlow which has recursive method call to traverse the DAG for a flow.
@param flow Executable flow object
@return
@throws ExecutorManagerException | getJobTypesForFlow | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | Apache-2.0 |
private static void populateJobTypeForFlow(final ExecutableNode node, Set<String> jobTypes) {
if (node instanceof ExecutableFlowBase) {
final ExecutableFlowBase base = (ExecutableFlowBase) node;
for (ExecutableNode subNode : base.getExecutableNodes()) {
populateJobTypeForFlow(subNode, jobTypes);... | This method is used to populate jobTypes for ExecutableNode.
@param node
@param jobTypes | populateJobTypeForFlow | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | Apache-2.0 |
public static int getFlowNameHashValMapping(ExecutableFlow flow) {
// Flow name is <projectName>.<flowId>
String flowName = flow.getFlowName();
byte[] flowNameBytes = flowName.getBytes(StandardCharsets.UTF_8);
// To be utilized for flow deterministic ramp-up
int flowNameHashVal = Math.abs(MurmurHash... | Return the int mapping between 1 to 100 for a given flow name
@param flow
@return | getFlowNameHashValMapping | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | Apache-2.0 |
public static Set<String> getProxyUsersForFlow(final ProjectManager projectManager,
final ExecutableFlow flow, final Map<String, String> flowParam) {
final Set<String> proxyUsers = new HashSet<>();
// First add the proxy user from the top level flow parameter. Adding this here as individual job
// ma... | Return the int mapping between 1 to 100 for a given flow name
@param flow
@return | getProxyUsersForFlow | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | Apache-2.0 |
public static void populateProxyUsersForFlow(final ExecutableNode node, final Flow flowObj,
final Project project, final ProjectManager projectManager, Set<String> proxyUsers) {
if (node instanceof ExecutableFlowBase) {
final ExecutableFlowBase base = (ExecutableFlowBase) node;
for (ExecutableNode... | Return the int mapping between 1 to 100 for a given flow name
@param flow
@return | populateProxyUsersForFlow | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | Apache-2.0 |
public static HashMap<String, String> parseJobTypeUsersForFlow(String jobTypePrefetchUserMap) {
HashMap<String, String> jobTypeProxyUserMap = new HashMap<>();
if (!jobTypePrefetchUserMap.isEmpty()) {
StringTokenizer st = new StringTokenizer(jobTypePrefetchUserMap, ";");
String whiteSpaceRegex = "[\\... | Return the int mapping between 1 to 100 for a given flow name
@param flow
@return | parseJobTypeUsersForFlow | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | Apache-2.0 |
public static Set<String> getJobTypeUsersForFlow(HashMap<String, String> jobTypePrefetchUserMap,
TreeSet<String> jobTypes) {
Set<String> jobTypeProxyUserSet = new HashSet<>();
for (String jobType : jobTypes) {
String proxyUser = jobTypePrefetchUserMap.get(jobType);
if (proxyUser != null && !pr... | Return the int mapping between 1 to 100 for a given flow name
@param flow
@return | getJobTypeUsersForFlow | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerImplUtils.java | Apache-2.0 |
public ContainerizedImpl getContainerizedImpl() {
return this.containerizedImpl;
} | This class is used to dispatch execution on Containerized infrastructure. Each execution will be
dispatched in single container. This way, it will bring isolation between all the executions.
When the flow will be executed or triggered by schedule, it will be added in a queue maintained
in database. The state of executi... | getContainerizedImpl | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public ContainerJobTypeCriteria getContainerJobTypeCriteria() {
return this.containerJobTypeCriteria;
} | This class is used to dispatch execution on Containerized infrastructure. Each execution will be
dispatched in single container. This way, it will bring isolation between all the executions.
When the flow will be executed or triggered by schedule, it will be added in a queue maintained
in database. The state of executi... | getContainerJobTypeCriteria | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public ContainerRampUpCriteria getContainerRampUpCriteria() {
return this.containerRampUpCriteria;
} | This class is used to dispatch execution on Containerized infrastructure. Each execution will be
dispatched in single container. This way, it will bring isolation between all the executions.
When the flow will be executed or triggered by schedule, it will be added in a queue maintained
in database. The state of executi... | getContainerRampUpCriteria | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public ContainerProxyUserCriteria getContainerProxyUserCriteria(){
return this.containerProxyUserCriteria;
} | This class is used to dispatch execution on Containerized infrastructure. Each execution will be
dispatched in single container. This way, it will bring isolation between all the executions.
When the flow will be executed or triggered by schedule, it will be added in a queue maintained
in database. The state of executi... | getContainerProxyUserCriteria | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public ContainerFlowCriteria getContainerFlowCriteria() {
return this.containerFlowCriteria;
} | This class is used to dispatch execution on Containerized infrastructure. Each execution will be
dispatched in single container. This way, it will bring isolation between all the executions.
When the flow will be executed or triggered by schedule, it will be added in a queue maintained
in database. The state of executi... | getContainerFlowCriteria | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public List<Integer> getQueuedFlowIds() {
final List<Integer> allIds = new ArrayList<>();
try {
allIds.addAll(this.executorLoader.selectQueuedFlows(Status.DISPATCHING));
allIds.addAll(this.executorLoader.selectQueuedFlows(Status.PREPARING));
} catch (final ExecutorManagerException e) {
log... | Get queued flow ids from database. The status for queued flows is PREPARING or DISPATCHING for
containerization.
@return | getQueuedFlowIds | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public long getQueuedFlowSize() {
return getQueuedFlowIds().size();
} | Get size of queued flows. The status for queued flows is PREPARING or DISPATCHING for containerization.
@return | getQueuedFlowSize | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public DispatchMethod getDispatchMethod() {
return this.containerRampUpCriteria.getDispatchMethod();
} | Get dispatch method enum for this class.
@return | getDispatchMethod | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public DispatchMethod getDispatchMethod(final ExecutableFlow flow) {
ExecutionOptions executionOptions = flow.getExecutionOptions();
if (executionOptions != null) {
final Map<String, String> flowParam = executionOptions.getFlowParameters();
if (flowParam != null && !flowParam.isEmpty()) ... | This method is used to get dispatch method for a flow based on multiple criteria mentioned
below.
a) If @Constants.FlowParameters.FLOW_PARAM_DISPATCH_EXECUTION_TO_CONTAINER is set to true
then dispatch method should be containerized
b) If @ExecutionOptions.USE_EXECUTOR is set then dispatch method should be POLL.
c) If ... | getDispatchMethod | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
private DispatchMethod getDispatchMethodUsingCriteria(final ExecutableFlow flow) {
DispatchMethod dispatchMethod = this.containerRampUpCriteria.getDispatchMethod(flow);
logger.info("Dispatch method by ramp up criteria is " +
dispatchMethod.name() + " for " + flow.getFlowName() + " flow.");
if (dispa... | This method is used to get dispatch method for a flow based on multiple criteria mentioned
below.
a) If @Constants.FlowParameters.FLOW_PARAM_DISPATCH_EXECUTION_TO_CONTAINER is set to true
then dispatch method should be containerized
b) If @ExecutionOptions.USE_EXECUTOR is set then dispatch method should be POLL.
c) If ... | getDispatchMethodUsingCriteria | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public void start() {
this.queueProcessor = setupQueueProcessor();
this.queueProcessor.start();
startWatch();
this.executorHealthChecker.ifPresent(ehc -> ehc.start());
} | This is responsible for starting processing loops for the containerized dispatch.
Currently this includes:
(1) This method is used to start queue processor thread. The queue processor thread will pick
execution from queue maintained in database and create a container for it.
(2) Starting container event watch, if pre... | start | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
private void startWatch() {
if (!containerizedWatch.isPresent()) {
logger.info("Containerized watch was not provided and will not be started");
return;
}
if (this.azkProps.getBoolean(ContainerizedDispatchManagerProperties.KUBERNETES_WATCH_ENABLED,
false)) {
logger.info("Starting co... | This is responsible for starting processing loops for the containerized dispatch.
Currently this includes:
(1) This method is used to start queue processor thread. The queue processor thread will pick
execution from queue maintained in database and create a container for it.
(2) Starting container event watch, if pre... | startWatch | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
private QueueProcessorThread setupQueueProcessor() {
return new QueueProcessorThread(
this.azkProps, this.executorLoader);
} | This is responsible for starting processing loops for the containerized dispatch.
Currently this includes:
(1) This method is used to start queue processor thread. The queue processor thread will pick
execution from queue maintained in database and create a container for it.
(2) Starting container event watch, if pre... | setupQueueProcessor | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public Status getStartStatus() {
return Status.READY;
} | Get the status for executions maintained in queue. For other dispatch implementations, the
status for executions in queue is PREPARING. But for containerized dispatch method, the status
will be READY.
@return | getStartStatus | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public Status getStartStatus(ExecutableFlow execFlow) {
if (execFlow.getDispatchMethod() == DispatchMethod.CONTAINERIZED) {
return Status.READY;
} else {
return Status.PREPARING;
}
} | @param execFlow {@link ExecutableFlow} containing all the information for a flow execution
including dispatch method which will be utilized here.
@return READY if the dispatchMethod is CONTAINERIZED otherwise PREPARING. | getStartStatus | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public void shutdown() {
logger.info("Shutting down queue processor thread for containerized dispatch implementation.");
if (null != this.queueProcessor) {
this.queueProcessor.shutdown();
}
if (this.azkProps.getBoolean(ContainerizedDispatchManagerProperties.KUBERNETES_WATCH_ENABLED,
... | This method will shutdown the queue processor thread. It won't pick up executions from queue
for dispatch after this. This method will be called when webserver will shutdown. | shutdown | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public void enableQueueProcessorThread() {
this.queueProcessor.setActive(true);
} | This method is used to enable queue processor thread. It will resume dispatching executions.
Due to any maintenance of containerized infrastructure, if queue processor was disabled then it
can enabled again using this method. | enableQueueProcessorThread | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public void disableQueueProcessorThread() {
this.queueProcessor.setActive(false);
} | This method is used to disable queue processor thread. It will stop dispatching executions. In
case of maintenance of containerized infrastructure, this method can be used to disable queue
processor. It will disable dispatch of executions in containers. | disableQueueProcessorThread | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public State getQueueProcessorThreadState() {
return this.queueProcessor.getState();
} | This method is used to disable queue processor thread. It will stop dispatching executions. In
case of maintenance of containerized infrastructure, this method can be used to disable queue
processor. It will disable dispatch of executions in containers. | getQueueProcessorThreadState | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public boolean isQueueProcessorThreadActive() {
return this.queueProcessor.isActive();
} | This method is used to disable queue processor thread. It will stop dispatching executions. In
case of maintenance of containerized infrastructure, this method can be used to disable queue
processor. It will disable dispatch of executions in containers. | isQueueProcessorThreadActive | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public void run() {
// Loops till QueueProcessorThread is shutdown
while (!this.shutdown) {
try {
// Start processing queue if active, otherwise wait for sometime
if (this.isActive) {
processQueuedFlows();
}
} catch (final Exception e) ... | This QueueProcessorThread will fetch executions from database in batch/single execution at a
time and dispatch it in container. | run | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
private void processQueuedFlows() throws ExecutorManagerException {
final Set<Integer> executionIds =
executorLoader.selectAndUpdateExecutionWithLocking(this.executionsBatchProcessingEnabled,
this.executionsBatchSize,
Status.DISPATCHING, DispatchMethod.CONTAINERIZED);
... | This method is responsible for dispatching the executions in queue in READY state. It will
fetch single execution or in batch based on the property. The batch size can also be defined
in property.
@throws ExecutorManagerException | processQueuedFlows | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public boolean isActive() {
return this.isActive;
} | This method is responsible for dispatching the executions in queue in READY state. It will
fetch single execution or in batch based on the property. The batch size can also be defined
in property.
@throws ExecutorManagerException | isActive | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public void setActive(final boolean isActive) {
this.isActive = isActive;
ContainerizedDispatchManager.logger
.info("QueueProcessorThread turned " + this.isActive);
} | This method is responsible for dispatching the executions in queue in READY state. It will
fetch single execution or in batch based on the property. The batch size can also be defined
in property.
@throws ExecutorManagerException | setActive | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public void shutdown() {
this.shutdown = true;
this.executorService.shutdown();
this.interrupt();
} | When queue process is shutting down, executor service for dispatch needs shutdown too. | shutdown | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@VisibleForTesting
public ExecutionDispatcher getExecutionDispatcher(int execId) {
return new ExecutionDispatcher(execId);
} | When queue process is shutting down, executor service for dispatch needs shutdown too. | getExecutionDispatcher | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public void run() {
try {
logger.info("Creating a container for {}", executionId);
long startTime = System.currentTimeMillis();
// Create a container for execution id. The container creation will throw exception if it
//is not able read template files, unable to parse... | This class is a worker class to dispatch execution in container. | run | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
protected void finalizeFlow(final ExecutableFlow flow, final String reason,
@Nullable final Throwable originalError, final Status finalFlowStatus) {
super.finalizeFlow(flow, reason, originalError, finalFlowStatus);
try {
this.containerizedImpl.deleteContainer(flow.getExecutionId());
... | Finalize the flow status in DB and delete the container. | finalizeFlow | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public void resumeFlow(ExecutableFlow exFlow, String userId) throws ExecutorManagerException {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | resumeFlow | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public void pauseFlow(ExecutableFlow exFlow, String userId) throws ExecutorManagerException {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | pauseFlow | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public void retryFailures(ExecutableFlow exFlow, String userId) throws ExecutorManagerException {
synchronized (exFlow) {
logger.info("Retrying failures for execId: {}", exFlow.getExecutionId());
final Pair<ExecutionReference, ExecutableFlow> pair = this.executorLoader
.fetchUnfin... | Finalize the flow status in DB and delete the container. | retryFailures | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public Map<String, Object> callExecutorStats(int executorId, String action,
Pair<String, String>... param) throws IOException, ExecutorManagerException {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | callExecutorStats | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public Map<String, Object> callExecutorJMX(String hostPort, String action, String mBean)
throws IOException {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | callExecutorJMX | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public Set<String> getAllActiveExecutorServerHosts() {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | getAllActiveExecutorServerHosts | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public State getExecutorManagerThreadState() {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | getExecutorManagerThreadState | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public boolean isExecutorManagerThreadActive() {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | isExecutorManagerThreadActive | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public long getLastExecutorManagerThreadCheckTime() {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | getLastExecutorManagerThreadCheckTime | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public Set<? extends String> getPrimaryServerHosts() {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | getPrimaryServerHosts | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public Collection<Executor> getAllActiveExecutors() {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | getAllActiveExecutors | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public Executor fetchExecutor(int executorId) throws ExecutorManagerException {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | fetchExecutor | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
@Override
public void setupExecutors() throws ExecutorManagerException {
throw new UnsupportedOperationException("Unsupported Method");
} | Finalize the flow status in DB and delete the container. | setupExecutors | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedDispatchManager.java | Apache-2.0 |
public Class getImplClass() {
return this.implClass;
} | This enum represents implementation for Containerization. For now, we are adding
implementation for Kubernetes but in future, execution can be dispatched on any other
containerized infrastructure. | getImplClass | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerizedImplType.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerizedImplType.java | Apache-2.0 |
@VisibleForTesting
public void updateAllowList(Set<String> allowList) {
this.allowList = allowList;
} | Class for determining {@link DispatchMethod} based on jobtype allowList. | updateAllowList | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | Apache-2.0 |
@VisibleForTesting
public void appendAllowList(Set<String> allowList) {
this.allowList.addAll(allowList);
} | Class for determining {@link DispatchMethod} based on jobtype allowList. | appendAllowList | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | Apache-2.0 |
@VisibleForTesting
public void removeFromAllowList(Set<String> allowList) {
this.allowList.removeAll(allowList);
} | Class for determining {@link DispatchMethod} based on jobtype allowList. | removeFromAllowList | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | Apache-2.0 |
@VisibleForTesting
public Set<String> getAllowList() {
return this.allowList;
} | Class for determining {@link DispatchMethod} based on jobtype allowList. | getAllowList | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | Apache-2.0 |
@VisibleForTesting
public String getAllowListAsString() {
return String.join(",", this.allowList);
} | Class for determining {@link DispatchMethod} based on jobtype allowList. | getAllowListAsString | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | Apache-2.0 |
public DispatchMethod getDispatchMethod(final ExecutableFlow flow) {
if (this.allowList.contains(ALL)) {
return DispatchMethod.CONTAINERIZED;
}
Set<String> jobTypesForFlow = ContainerImplUtils.getJobTypesForFlow(flow);
for (String jobType : jobTypesForFlow) {
if (!this.allowList.contains(job... | If the set of JobTypes extracted from the flow is not allowed, the return DispatchMethod.POLL
other DispatchMethod.CONTAINERIZED. If the allowList contains "ALL", then
DispatchMethod.CONTAINERIZED is returned. | getDispatchMethod | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerJobTypeCriteria.java | Apache-2.0 |
@VisibleForTesting
public void appendDenyList(final Set<String> denyList) { this.denyList.addAll(denyList); } | Class for determining {@link DispatchMethod} based on deny list | appendDenyList | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerProxyUserCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerProxyUserCriteria.java | Apache-2.0 |
@VisibleForTesting
public void removeFromDenyList(final Set<String> denyList) { this.denyList.removeAll(denyList); } | Class for determining {@link DispatchMethod} based on deny list | removeFromDenyList | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerProxyUserCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerProxyUserCriteria.java | Apache-2.0 |
@VisibleForTesting
public Set<String> getDenyList() { return this.denyList; } | Class for determining {@link DispatchMethod} based on deny list | getDenyList | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerProxyUserCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerProxyUserCriteria.java | Apache-2.0 |
@VisibleForTesting
public String getDenyListAsString() {
return String.join(",", this.denyList);
} | Class for determining {@link DispatchMethod} based on deny list | getDenyListAsString | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerProxyUserCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerProxyUserCriteria.java | Apache-2.0 |
public DispatchMethod getDispatchMethod(final ExecutableFlow flow) {
if (CollectionUtils.containsAny(flow.getProxyUsers(), this.denyList)) {
return DispatchMethod.POLL;
} else {
return DispatchMethod.CONTAINERIZED;
}
} | If the set of flow proxy users contains a proxy user on the deny list,
then return DispatchMethod.POLL, else return DispatchMethod.CONTAINERIZED
@param flow
@return DispatchMethod | getDispatchMethod | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerProxyUserCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerProxyUserCriteria.java | Apache-2.0 |
public DispatchMethod getDispatchMethod() {
if (this.rampUp == 0) {
return DispatchMethod.POLL;
} else if (this.rampUp == 100) {
return DispatchMethod.CONTAINERIZED;
}
ThreadLocalRandom rand = ThreadLocalRandom.current();
int randomInt = rand.nextInt(100);
if (randomInt < this.rampUp... | Return DispatchMethod based on the rampUp percentage and random selection | getDispatchMethod | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerRampUpCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerRampUpCriteria.java | Apache-2.0 |
public DispatchMethod getDispatchMethod(final ExecutableFlow flow) {
if (this.rampUp == 0) {
return DispatchMethod.POLL;
} else if (this.rampUp == 100) {
return DispatchMethod.CONTAINERIZED;
}
int flowNameHashValMapping = ContainerImplUtils.getFlowNameHashValMapping(flow);
if (flowNameH... | Return DispatchMethod based on the rampUp percentage and deterministic selection
based on the flow name | getDispatchMethod | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerRampUpCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerRampUpCriteria.java | Apache-2.0 |
@VisibleForTesting
public void setRampUp(int rampUp) {
this.rampUp = rampUp;
} | Return DispatchMethod based on the rampUp percentage and deterministic selection
based on the flow name | setRampUp | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerRampUpCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerRampUpCriteria.java | Apache-2.0 |
@VisibleForTesting
public int getRampUp() {
return this.rampUp;
} | Return DispatchMethod based on the rampUp percentage and deterministic selection
based on the flow name | getRampUp | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/ContainerRampUpCriteria.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/ContainerRampUpCriteria.java | Apache-2.0 |
private void addIncludedJobTypes() {
INCLUDED_JOB_TYPES.add("command");
INCLUDED_JOB_TYPES.add("gobblin");
INCLUDED_JOB_TYPES.add("hadoopJava");
INCLUDED_JOB_TYPES.add("hadoopShell");
INCLUDED_JOB_TYPES.add("hive");
INCLUDED_JOB_TYPES.add("java");
INCLUDED_JOB_TYPES.add("java2");
INCLUDE... | Populate the included job types set with all the types that are readily available as part of
azkaban base image. | addIncludedJobTypes | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private boolean isPresentInIncludedJobTypes(final String jobType) {
if (INCLUDED_JOB_TYPES.contains(jobType)) {
return true;
} else {
return isStartWithIncludedJobTypes(jobType);
}
} | Check if job type contains in the included job types. If not check if the job type starts with
the any of the job types present in the included job type set. For example, in case of pig job
type it can contain version such as pigLi-0.11.1. This is nothing but pointing to the different
installation pig job. Hence, it ju... | isPresentInIncludedJobTypes | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private boolean isStartWithIncludedJobTypes(final String jobType) {
for (final String includedJobType : INCLUDED_JOB_TYPES) {
if (jobType.toLowerCase().startsWith(includedJobType.toLowerCase())) {
return true;
}
}
return false;
} | Check if the job type starts with the aay of the job types present in the included job type
set. For example, in case of pig job type it can contain version such as pigLi-0.11.1. This is
nothing but pointing to the different installation pig job. Hence, it just matches the prefix
i.e. pigLi which is the actual job type... | isStartWithIncludedJobTypes | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private Set<String> filterIncludedJobTypes(final Set<String> jobTypes) {
return jobTypes.stream()
.filter(jobType -> !isPresentInIncludedJobTypes(jobType))
.collect(Collectors.toSet());
} | Filter out the included job types from the given job types.
@param jobTypes
@return Set<String> | filterIncludedJobTypes | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@Override
public synchronized void createContainer(final int executionId) throws ExecutorManagerException {
createPod(executionId);
if (isServiceRequired()) {
createService(executionId);
}
} | This method is used to create container during dispatch of execution. It will create pod for a
flow execution. It will also create a service for a pod if azkaban.kubernetes.service .required
property is set.
@param executionId
@throws ExecutorManagerException | createContainer | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@Override
public synchronized void deleteContainer(final int executionId) throws ExecutorManagerException {
try { // if pod deletion is not successful, the service deletion can still be handled
deletePod(executionId);
} finally {
if (isServiceRequired()) {
deleteService(executionId);
... | This method is used to delete container. It will delete pod for a flow execution. If the
service was created then it will also delete the service. This method can be called as a part
of cleanup process for containers in case containers didn't shutdown gracefully.
@param executionId
@throws ExecutorManagerException | deleteContainer | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@Override
public Set<Integer> getContainersByDuration(final Duration containerDuration) throws ExecutorManagerException {
// Get the list of pods from current Azkaban cluster and namespace
final V1PodList podList= this.getListNamespacedPod();
// Get all execution ids of the pods whose age is older than a... | This method is used to fetch all pods in the current az cluster and namespace that are
created a time duration ago
@param containerDuration duration between container start timestamp and current timestamp
@return Set of container's execution ids | getContainersByDuration | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private V1PodList getListNamespacedPod() throws ExecutorManagerException {
try {
// Select pods from current Azkaban cluster and namespace
final String label =
CLUSTER_LABEL_NAME + "=" + this.clusterName + "," + APP_LABEL_NAME + "=" + POD_APPLICATION_TAG;
return this.coreV1Api.listNamesp... | This method is used to fetch a list of all pods in the current az cluster and namespace
@return
@throws ExecutorManagerException | getListNamespacedPod | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@VisibleForTesting
Set<Integer> getExecutionIdsFromPodList(final V1PodList podList, final OffsetDateTime validStartTimeStamp) {
final Set<Integer> staleContainerExecIdSet = new HashSet<>();
for (final V1Pod pod: podList.getItems()) {
final V1ObjectMeta podMetadata = pod.getMetadata();
if (podMetad... | Obtain a set of execution ids from stale pod list
@param podList a stable pod list fetched from current az cluster and namespace
@param validStartTimeStamp earliest creation timestamp for a valid pod
@return | getExecutionIdsFromPodList | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private String imageTypeOverrideParam(final String imageType) {
return String.join(".", IMAGE, imageType, VERSION);
} | Construct the flow override parameter (key) for image version.
@param imageType
@return flow override param | imageTypeOverrideParam | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@VisibleForTesting
VersionSet fetchVersionSet(final int executionId, final Map<String, String> flowParams,
Set<String> imageTypesUsedInFlow, final ExecutableFlow executableFlow)
throws ExecutorManagerException {
VersionSet versionSet = null;
try {
if (flowParams != null &&
flowPar... | This method fetches the complete version set information (Map of jobs and their versions)
required to run the flow.
@param flowParams Set of flow properties and flow parameters
@param imageTypesUsedInFlow
@return VersionSet
@throws ExecutorManagerException | fetchVersionSet | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@VisibleForTesting
V1PodSpec createPodSpec(final ExecutableFlow executableFlow,
final FlowResourceRecommendation flowResourceRecommendation,
final ConcurrentHashMap<String, FlowResourceRecommendation> flowResourceRecommendationMap,
final VersionSet versionSet,
final SortedSet<String> jobTypes,... | @param executableFlow
@param flowResourceRecommendation
@param flowResourceRecommendationMap
@param versionSet
@param jobTypes
@param dependencyTypes
@return
@throws ExecutorManagerException | createPodSpec | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@VisibleForTesting
V1ObjectMeta createPodMetadata(final ExecutableFlow executableFlow,
final int flowResourceRecommendationId, Map<String, String> flowParam) {
return new V1ObjectMetaBuilder()
.withName(getPodName(executableFlow.getExecutionId()))
.withNamespace(this.namespace)
.addT... | @param executableFlow
@param flowResourceRecommendation
@param flowResourceRecommendationMap
@param versionSet
@param jobTypes
@param dependencyTypes
@return
@throws ExecutorManagerException | createPodMetadata | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@VisibleForTesting
VPARecommendation getFlowContainerRecommendedRequests(final ExecutableFlow executableFlow,
final FlowResourceRecommendation flowResourceRecommendation,
final ConcurrentHashMap<String, FlowResourceRecommendation> flowResourceRecommendationMap) {
// VPA is disabled globally: do not cr... | Create FlowResourceRecommendation if not exist; Get recommended requests from VPA; Persist
recommendation to DB for caching if changed.
@param executableFlow
@param flowResourceRecommendation
@param flowResourceRecommendationMap it is used for updating flowResourceRecommendation
@return Nullable CPU request and nullab... | getFlowContainerRecommendedRequests | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@VisibleForTesting
String getFlowContainerCPURequest(final Map<String, String> flowParam,
@Nullable final String CPURequestFromVPA) {
String cpuRequest = getRawFlowContainerCPURequest(flowParam, CPURequestFromVPA);
if (compareResources(cpuRequest, this.minAllowedCPU) <= 0) {
return this.minAllowed... | This method is used to get cpu request for a flow container. Precedence is defined below. a)
Use max(CPU request set in flow parameter, CPU request recommendation value from VPA) b) Use
cpu request set in system properties or default which is set in @cpuRequest.
Above result is constrained by min&max allowed cpu set in... | getFlowContainerCPURequest | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private String getRawFlowContainerCPURequest(final Map<String, String> flowParam,
@Nullable final String CPURequestFromVPA) {
String cpuRequest = null;
if (flowParam != null && !flowParam.isEmpty() && flowParam
.containsKey(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_CPU_REQUEST)) {
cpuRequest ... | This method is used to get cpu request for a flow container. Precedence is defined below. a)
Use max(CPU request set in flow parameter, CPU request recommendation value from VPA) b) Use
cpu request set in system properties or default which is set in @cpuRequest.
Above result is constrained by min&max allowed cpu set in... | getRawFlowContainerCPURequest | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@VisibleForTesting
String getFlowContainerMemoryRequest(final Map<String, String> flowParam,
@Nullable final String memoryRequestFromVPA) {
String memoryRequest = getRawFlowContainerMemoryRequest(flowParam, memoryRequestFromVPA);
if (compareResources(memoryRequest, this.minAllowedMemory) <= 0) {
r... | This method is used to get memory request for a flow container. Precedence is defined below. a)
Use max(memory request set in flow parameter, memory request recommendation value from VPA) b)
Use memory request set in system properties or default which is set in @memoryRequest
Above result is constrained by min&max allo... | getFlowContainerMemoryRequest | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private String getRawFlowContainerMemoryRequest(final Map<String, String> flowParam,
@Nullable final String memoryRequestFromVPA) {
String memoryRequest = null;
if (flowParam != null && !flowParam.isEmpty() && flowParam
.containsKey(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_MEMORY_REQUEST)) {
... | This method is used to get memory request for a flow container. Precedence is defined below. a)
Use max(memory request set in flow parameter, memory request recommendation value from VPA) b)
Use memory request set in system properties or default which is set in @memoryRequest
Above result is constrained by min&max allo... | getRawFlowContainerMemoryRequest | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@VisibleForTesting
String getFlowContainerDiskRequest(final Map<String, String> flowParam) {
if (flowParam == null || flowParam.isEmpty() || !flowParam
.containsKey(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_DISK_REQUEST)) {
return this.diskRequest;
}
String userDiskRequest =
flowPara... | This method is used to get disk request for flow container. Precedence is defined below.
a) Use disk request set in flow parameter constrained by max allowed disk set in config
b) Use disk request set in system properties or default is set in @diskRequest
@param flowParam
@return Disk request for a flow container | getFlowContainerDiskRequest | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private static int compareResources(final String resource1, final String resource2) {
try {
final Quantity quantity1 = new Quantity(resource1), quantity2 = new Quantity(resource2);
return quantity1.getNumber().compareTo(quantity2.getNumber()) < 0 ? -1 : 1;
} catch (final Exception e) { // only user ... | This method compares resource 1 (e.g. max allowed resource) with resource 2 (e.g. user
requested resource):
1) if resource 1 >= resource 2, return 1;
2) if resource 1 < resource 2, return -1;
3) if resource 1 cannot be compared with resource 2, e.g. parse error, return 0;
The format of a Kubernetes quantity indicates t... | compareResources | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private static boolean isValidResource(final String resource) {
try {
new Quantity(resource);
} catch (final Exception e) {
return false;
}
return true;
} | This method compares resource 1 (e.g. max allowed resource) with resource 2 (e.g. user
requested resource):
1) if resource 1 >= resource 2, return 1;
2) if resource 1 < resource 2, return -1;
3) if resource 1 cannot be compared with resource 2, e.g. parse error, return 0;
The format of a Kubernetes quantity indicates t... | isValidResource | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private void setupJavaRemoteDebug(final Map<String, String> envVariables,
final Map<String, String> flowParam) {
if (flowParam != null && !flowParam.isEmpty() && flowParam
.containsKey(Constants.FlowParameters.FLOW_PARAM_JAVA_ENABLE_DEBUG)) {
envVariables.put(ContainerizedDispatchManagerProperti... | This method is used to setup environment variable to enable remote debug on kubernetes flow
container. Based on this environment variable, you can decide to enable or disable remote
debug.
@param envVariables
@param flowParam | setupJavaRemoteDebug | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private void setupDevPod(final Map<String, String> envVariables,
final Map<String, String> flowParam) {
if (isDevPod(flowParam)) {
envVariables.put(ContainerizedDispatchManagerProperties.ENV_ENABLE_DEV_POD,
flowParam.get(FlowParameters.FLOW_PARAM_ENABLE_DEV_POD));
}
} | This method is used to setup environment variable to enable pod as dev pod which can be helpful
for testing. Based on this environment variable, you can decide to start the flow container or
not.
@param envVariables
@param flowParam | setupDevPod | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
void setupPodEnvVariables(final Map<String, String> envVariables,
final Map<String, String> flowParam) {
if (flowParam != null && !flowParam.isEmpty()) {
flowParam.forEach((k, v) -> {
if (k.startsWith(FlowParameters.FLOW_PARAM_POD_ENV_VAR)) {
envVariables
.put(StringUtils... | This method is used to setup any environment variable for a pod which can be passed from flow
parameter. To provide the generic solution, it is adding all the flow parameters starting with
(@FlowParameters.FLOW_PARAM_POD_ENV_VAR)
@param envVariables
@param flowParam | setupPodEnvVariables | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private void addEnvVariablesToSpecBuilder(final AzKubernetesV1SpecBuilder v1SpecBuilder,
final Map<String, String> envVariables) {
envVariables.forEach((key, value) -> v1SpecBuilder.addEnvVarToFlowContainer(key, value));
} | Adding environment variables in pod spec builder.
@param v1SpecBuilder
@param envVariables | addEnvVariablesToSpecBuilder | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
@VisibleForTesting
V1Pod createPodFromMetadataAndSpec(final V1ObjectMeta podMetadata, final V1PodSpec podSpec) {
return new AzKubernetesV1PodBuilder(podMetadata, podSpec).build();
} | Creates a pod instance.
@param podMetadata metadata to use during pod instantiation
@param podSpec spec to use during pod instantiation
@return a {@link V1Pod} instance | createPodFromMetadataAndSpec | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
private static void logPodSpecYaml(final int executionId, final Object podObject,
final Map<String, String> flowParam, String message) {
final String podSpecYaml = Yaml.dump(podObject).trim();
if (isDevPod(flowParam)) {
logger.info(message, executionId, podSpecYaml);
} else {
logger.debug(... | This method is used to log pod spec yaml for debugging purpose. If Pod is marked as dev pod
then pod spec yaml will be printed in logs for INFO level else it will be logged for DEBUG
level.
@param executionId
@param podObject Pod/PodSpec depending on the log
@param flowParam | logPodSpecYaml | java | azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.