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 handleDeleteImageVersion(final HttpServletRequest req,
final HttpServletResponse resp, final Session session,
final Map<String, String> templateVariableToValue) throws ServletException,
IOException {
try {
final String idString = templateVariableToValue.get(IMAGE_VERSION_ID_KEY);
final Integer id = Ints.tryParse(idString);
if (id == null) {
log.error("Invalid image version id: ", idString);
throw new ImageMgmtValidationException("Image version id is invalid");
}
final String imageType = HttpRequestUtils.getParam(req, ImageMgmtConstants.IMAGE_TYPE);
// Check for required permission to invoke the API
if (imageType == null) {
log.info("Required field imageType is null. Must provide valid imageType to update image "
+ "version.");
throw new ImageMgmtValidationException(ErrorCode.BAD_REQUEST, "Required field imageType is"
+ " null. Must provide valid imageType to update image version.");
}
if (!hasImageManagementPermission(imageType, session.getUser(), Type.DELETE)) {
log.debug(String.format("Invalid permission to delete image version "
+ "for user: %s, image type: %s.", session.getUser().getUserId(), imageType));
throw new ImageMgmtInvalidPermissionException(ErrorCode.FORBIDDEN, "Invalid permission to "
+ "delete image version");
}
final String strForceDelete = HttpRequestUtils.getParam(req, "forceDelete", null);
final Boolean forceDelete = strForceDelete == null ? Boolean.FALSE :
Boolean.valueOf(strForceDelete);
// Invoke delete image version metadata for image version id and image type
final DeleteResponse deleteResponse = this.imageMgmtCommonService
.deleteImageVersion(imageType, id,
forceDelete);
if (deleteResponse.hasErrors()) {
sendResponse(resp, deleteResponse.getErrorCode().get().getCode(),
deleteResponse.getMessage(), deleteResponse.getData().orElse(null));
} else {
sendResponse(resp, HttpServletResponse.SC_OK, deleteResponse.getMessage());
}
log.info("ImageType {} with imageVersionId {} is deleted successfully", imageType, idString);
} catch (final ImageMgmtException e) {
log.error("Exception while deleting image version metadata", e);
sendErrorResponse(resp, e.getErrorCode().getCode(), e.getMessage());
} catch (final Exception e) {
log.error("Exception while deleting image version metadata", e);
sendErrorResponse(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Exception while deleting image version metadata. " + e.getMessage());
}
}
|
This servlet exposes the REST APIs such as create, get etc. for image type. Below are the
supported APIs. Create Image Version API: POST /imageVersions?session.id=? --data @payload.json
Search/Get Image Versions API: GET /imageVersions?session.id=?&imageType=?&imageVersion=?&versionState=?
GET /imageVersions/{id}?session.id=? Update image version API: POST
/imageVersions/{id}?session.id=? --data @payload.json
|
handleDeleteImageVersion
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/imagemgmt/servlets/ImageVersionServlet.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/imagemgmt/servlets/ImageVersionServlet.java
|
Apache-2.0
|
public static <T> boolean validateObject(final T obj, final List<String> validationErrors) {
final Validator validator = validatorFactory.getValidator();
final Set<ConstraintViolation<T>> violations = validator.validate(obj);
if (violations.isEmpty()) {
return true;
}
log.error("Object validation failed for: " + obj.toString());
violations.forEach(violation -> {
validationErrors.add(violation.getMessage());
log.error(violation.getPropertyPath().toString() + " " + violation.getMessage());
});
return false;
}
|
Performs validation the supplied object and creates set of violations. Returns if there is no
violation. Returns false if there exist any violation.
@param obj
@param <T>
@param validationErrors
@return boolean
|
validateObject
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/imagemgmt/utils/ValidatorUtils.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/imagemgmt/utils/ValidatorUtils.java
|
Apache-2.0
|
public static <T> boolean validateObject(final T obj, final List<String> validationErrors,
final Class<?> validationGroup) {
final Validator validator = validatorFactory.getValidator();
final Set<ConstraintViolation<T>> violations = validator.validate(obj, validationGroup);
if (violations.isEmpty()) {
return true;
}
log.error("Object validation failed for: " + obj.toString());
violations.forEach(violation -> {
validationErrors.add(violation.getMessage());
log.error(violation.getPropertyPath().toString() + " " + violation.getMessage());
});
return false;
}
|
Performs validation the supplied object and creates set of violations. Returns if there is no
violation. Returns false if there exist any violation. This method performs validation for the
annotations with validation group class.
@param obj
@param <T>
@return boolean
|
validateObject
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/imagemgmt/utils/ValidatorUtils.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/imagemgmt/utils/ValidatorUtils.java
|
Apache-2.0
|
protected static <T extends Serializable> T asT(final Object service, final Class<T> type) {
return type.cast(service);
}
|
Cast the object to the original one with the type. The object must extend Serializable.
|
asT
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/AbstractQuartzJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/AbstractQuartzJob.java
|
Apache-2.0
|
protected Object getKey(final JobExecutionContext context, final String key) {
return context.getMergedJobDataMap().get(key);
}
|
Cast the object to the original one with the type. The object must extend Serializable.
|
getKey
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/AbstractQuartzJob.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/AbstractQuartzJob.java
|
Apache-2.0
|
public String getJobName() {
return jobName;
}
|
This check is necessary for raw type. Please see test
{@link QuartzJobDescriptionTest#testCreateQuartzJobDescription2}
|
getJobName
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzJobDescription.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzJobDescription.java
|
Apache-2.0
|
public Class<? extends AbstractQuartzJob> getJobClass() {
return this.jobClass;
}
|
This check is necessary for raw type. Please see test
{@link QuartzJobDescriptionTest#testCreateQuartzJobDescription2}
|
getJobClass
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzJobDescription.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzJobDescription.java
|
Apache-2.0
|
public Map<String, ? extends Serializable> getContextMap() {
return this.contextMap;
}
|
This check is necessary for raw type. Please see test
{@link QuartzJobDescriptionTest#testCreateQuartzJobDescription2}
|
getContextMap
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzJobDescription.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzJobDescription.java
|
Apache-2.0
|
@Override
public String toString() {
return "QuartzJobDescription{" +
"jobClass=" + this.jobClass +
", groupName='" + this.groupName + '\'' +
", contextMap=" + this.contextMap +
'}';
}
|
This check is necessary for raw type. Please see test
{@link QuartzJobDescriptionTest#testCreateQuartzJobDescription2}
|
toString
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzJobDescription.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzJobDescription.java
|
Apache-2.0
|
public String getGroupName() {
return this.groupName;
}
|
This check is necessary for raw type. Please see test
{@link QuartzJobDescriptionTest#testCreateQuartzJobDescription2}
|
getGroupName
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzJobDescription.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzJobDescription.java
|
Apache-2.0
|
public void start() throws SchedulerException {
this.scheduler.start();
logger.info("Quartz Scheduler started.");
}
|
Manages Quartz schedules. Azkaban regards QuartzJob and QuartzTrigger as an one-to-one
mapping.
Quartz job key naming standard:
Job key is composed of job name and group name. Job type denotes job name. Project id+flow
name denotes group name.
E.x FLOW_TRIGGER as job name, 1.flow1 as group name
|
start
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
Apache-2.0
|
@VisibleForTesting
void cleanup() throws SchedulerException {
this.scheduler.clear();
}
|
Manages Quartz schedules. Azkaban regards QuartzJob and QuartzTrigger as an one-to-one
mapping.
Quartz job key naming standard:
Job key is composed of job name and group name. Job type denotes job name. Project id+flow
name denotes group name.
E.x FLOW_TRIGGER as job name, 1.flow1 as group name
|
cleanup
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
Apache-2.0
|
public void shutdown() throws SchedulerException {
this.scheduler.shutdown();
logger.info("Quartz Scheduler shut down.");
}
|
Manages Quartz schedules. Azkaban regards QuartzJob and QuartzTrigger as an one-to-one
mapping.
Quartz job key naming standard:
Job key is composed of job name and group name. Job type denotes job name. Project id+flow
name denotes group name.
E.x FLOW_TRIGGER as job name, 1.flow1 as group name
|
shutdown
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
Apache-2.0
|
public synchronized boolean pauseJobIfPresent(final String jobName, final String groupName)
throws SchedulerException {
if (ifJobExist(jobName, groupName)) {
this.scheduler.pauseJob(new JobKey(jobName, groupName));
return true;
} else {
return false;
}
}
|
Pause a job if it's present.
@param jobName
@param groupName
@return true if job has been paused, no if job doesn't exist.
@throws SchedulerException
|
pauseJobIfPresent
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
Apache-2.0
|
public synchronized boolean isJobPaused(final String jobName, final String groupName)
throws SchedulerException {
if (!ifJobExist(jobName, groupName)) {
throw new SchedulerException(String.format("Job (job name %s, group name %s) doesn't "
+ "exist'", jobName, groupName));
}
final JobKey jobKey = new JobKey(jobName, groupName);
final JobDetail jobDetail = this.scheduler.getJobDetail(jobKey);
final List<? extends Trigger> triggers = this.scheduler.getTriggersOfJob(jobDetail.getKey());
for (final Trigger trigger : triggers) {
final TriggerState triggerState = this.scheduler.getTriggerState(trigger.getKey());
if (TriggerState.PAUSED.equals(triggerState)) {
return true;
}
}
return false;
}
|
Check if job is paused.
@return true if job is paused, false otherwise.
|
isJobPaused
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
Apache-2.0
|
public synchronized boolean resumeJobIfPresent(final String jobName, final String groupName)
throws SchedulerException {
if (ifJobExist(jobName, groupName)) {
this.scheduler.resumeJob(new JobKey(jobName, groupName));
return true;
} else {
return false;
}
}
|
Resume a job.
@param jobName
@param groupName
@return true the job has been resumed, no if the job doesn't exist.
@throws SchedulerException
|
resumeJobIfPresent
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
Apache-2.0
|
public synchronized boolean unscheduleJob(final String jobName, final String groupName) throws
SchedulerException {
return this.scheduler.deleteJob(new JobKey(jobName, groupName));
}
|
Unschedule a job.
@param jobName
@param groupName
@return true if job is found and unscheduled.
@throws SchedulerException
|
unscheduleJob
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
Apache-2.0
|
public synchronized boolean scheduleJobIfAbsent(final String cronExpression, final QuartzJobDescription
jobDescription) throws SchedulerException {
requireNonNull(jobDescription, "jobDescription is null");
if (ifJobExist(jobDescription.getJobName(), jobDescription.getGroupName())) {
logger.warn(String.format("can not register existing job with job name: "
+ "%s and group name: %s", jobDescription.getJobName(), jobDescription.getGroupName()));
return false;
}
if (!CronExpression.isValidExpression(cronExpression)) {
throw new SchedulerException(
"The cron expression string <" + cronExpression + "> is not valid.");
}
// TODO kunkun-tang: we will modify this when we start supporting multi schedules per flow.
final JobDetail job = JobBuilder.newJob(jobDescription.getJobClass())
.withIdentity(jobDescription.getJobName(), jobDescription.getGroupName()).build();
// Add external dependencies to Job Data Map.
job.getJobDataMap().putAll(jobDescription.getContextMap());
// TODO kunkun-tang: Need management code to deal with different misfire policy
final Trigger trigger = TriggerBuilder
.newTrigger()
.withSchedule(
CronScheduleBuilder.cronSchedule(cronExpression)
.withMisfireHandlingInstructionFireAndProceed()
)
.build();
this.scheduler.scheduleJob(job, trigger);
logger.info("Quartz Schedule with jobDetail " + job.getDescription() + " is registered.");
return true;
}
|
Only cron schedule register is supported. Since register might be called when
concurrently uploading projects, so synchronized is added to ensure thread safety.
@param cronExpression the cron schedule for this job
@param jobDescription Regarding QuartzJobDescription#groupName, in order to guarantee no
duplicate quartz schedules, we design the naming convention depending on use cases: <ul>
<li>User flow schedule: we use {@link JobKey#JobKey} to represent the identity of a
flow's schedule. The format follows "$projectID.$flowName" to guarantee no duplicates.
<li>Quartz schedule for AZ internal use: the groupName should start with letters, rather
than
number, which is the first case.</ul>
@return true if job has been scheduled, false if the same job exists already.
|
scheduleJobIfAbsent
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
Apache-2.0
|
@VisibleForTesting
boolean ifJobExist(final String jobName, final String groupName)
throws SchedulerException {
return this.scheduler.getJobDetail(new JobKey(jobName, groupName)) != null;
}
|
Only cron schedule register is supported. Since register might be called when
concurrently uploading projects, so synchronized is added to ensure thread safety.
@param cronExpression the cron schedule for this job
@param jobDescription Regarding QuartzJobDescription#groupName, in order to guarantee no
duplicate quartz schedules, we design the naming convention depending on use cases: <ul>
<li>User flow schedule: we use {@link JobKey#JobKey} to represent the identity of a
flow's schedule. The format follows "$projectID.$flowName" to guarantee no duplicates.
<li>Quartz schedule for AZ internal use: the groupName should start with letters, rather
than
number, which is the first case.</ul>
@return true if job has been scheduled, false if the same job exists already.
|
ifJobExist
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
Apache-2.0
|
public Scheduler getScheduler() {
return this.scheduler;
}
|
Only cron schedule register is supported. Since register might be called when
concurrently uploading projects, so synchronized is added to ensure thread safety.
@param cronExpression the cron schedule for this job
@param jobDescription Regarding QuartzJobDescription#groupName, in order to guarantee no
duplicate quartz schedules, we design the naming convention depending on use cases: <ul>
<li>User flow schedule: we use {@link JobKey#JobKey} to represent the identity of a
flow's schedule. The format follows "$projectID.$flowName" to guarantee no duplicates.
<li>Quartz schedule for AZ internal use: the groupName should start with letters, rather
than
number, which is the first case.</ul>
@return true if job has been scheduled, false if the same job exists already.
|
getScheduler
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
|
Apache-2.0
|
@Override
public Job newJob(final TriggerFiredBundle bundle, final Scheduler scheduler)
throws SchedulerException {
return (Job) this.injector.getInstance(bundle.getJobDetail()
.getJobClass());
}
|
Produce Guice-able Job in this custom defined Job Factory.
In order to allow Quaratz jobs easily inject dependency, we create this factory. Every Quartz job
will be constructed by newJob method.
|
newJob
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/scheduler/SchedulerJobFactory.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/scheduler/SchedulerJobFactory.java
|
Apache-2.0
|
@Override
public void doFilter(
final ServletRequest request,
final ServletResponse response,
final FilterChain chain)
throws IOException, ServletException {
final HttpServletRequest req = (HttpServletRequest) request;
final String requestURI = req.getRequestURI();
final AbstractAzkabanServlet servlet = this.routesMap.get(requestURI);
if (servlet != null) {
if (servlet instanceof LoginAbstractAzkabanServlet) {
final LoginAbstractAzkabanServlet loginServlet = (LoginAbstractAzkabanServlet) servlet;
if (loginServlet.isUserAuthenticated(req)) {
// Process authenticated requests
recordMetrics(chain, req, response, loginServlet);
} else {
// Process login requests
recordOnlyAuthenticationMetrics(chain, req, response, loginServlet);
}
} else {
// Process /status calls
recordMetrics(chain, req, response, servlet);
}
} else {
// Skip URIs not registered with the filter
chain.doFilter(request, response);
}
}
|
Servlet filter in charge of recording all api endpoint metrics.
|
doFilter
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
Apache-2.0
|
@Override
public void init(final FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
|
Servlet filter in charge of recording all api endpoint metrics.
|
init
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
Apache-2.0
|
@Override
public void destroy() {
this.filterConfig = null;
}
|
Servlet filter in charge of recording all api endpoint metrics.
|
destroy
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
Apache-2.0
|
private void recordMetrics(
final FilterChain chain,
final HttpServletRequest request,
final ServletResponse response,
final AbstractAzkabanServlet servlet) throws IOException, ServletException {
final long startTime = System.currentTimeMillis();
final Optional<AzkabanAPI> action = servlet.getAzkabanAPI(request);
action.ifPresent(a -> recordOriginMetrics(request, a));
try {
chain.doFilter(request, response);
} finally {
action.ifPresent(a -> a.getMetrics().addResponseTime(System.currentTimeMillis() - startTime));
}
}
|
Servlet filter in charge of recording all api endpoint metrics.
|
recordMetrics
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
Apache-2.0
|
private void recordOnlyAuthenticationMetrics(
final FilterChain chain,
final HttpServletRequest request,
final ServletResponse response,
final LoginAbstractAzkabanServlet servlet) throws IOException, ServletException {
final long startTime = System.currentTimeMillis();
final AzkabanAPI loginAPI = servlet.getLoginAPI();
final String[] actionParam = request.getParameterValues(loginAPI.getRequestParameter());
if (actionParam != null && Arrays.asList(actionParam).contains(loginAPI.getParameterValue())) {
recordOriginMetrics(request, loginAPI);
try {
chain.doFilter(request, response);
} finally {
loginAPI.getMetrics().addResponseTime(System.currentTimeMillis() - startTime);
}
} else {
chain.doFilter(request, response);
}
}
|
Servlet filter in charge of recording all api endpoint metrics.
|
recordOnlyAuthenticationMetrics
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
Apache-2.0
|
protected void recordOriginMetrics(final HttpServletRequest request, final AzkabanAPI api) {
final AzkabanAPIMetrics metrics = api.getMetrics();
final String reqOrigin = request.getHeader(HTTP_HEADER_AZKABAN_TRACE_ORIGIN);
final boolean isReqFromWebApp = HTTP_HEADER_VALUE_AZKABAN_TRACE_ORIGIN.equals(reqOrigin);
final String reqHttpMethod = request.getMethod();
if (isReqFromWebApp && "GET".equals(reqHttpMethod)) {
metrics.incrementAppGetRequests();
}
if (isReqFromWebApp && "POST".equals(reqHttpMethod)) {
metrics.incrementAppPostRequests();
}
if (!isReqFromWebApp && "GET".equals(reqHttpMethod)) {
metrics.incrementNonAppGetRequests();
}
if (!isReqFromWebApp && "POST".equals(reqHttpMethod)) {
metrics.incrementNonAppPostRequests();
}
}
|
Servlet filter in charge of recording all api endpoint metrics.
|
recordOriginMetrics
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/APIMetricsFilter.java
|
Apache-2.0
|
@Deprecated
public static AzkabanWebServer getInstance() {
return app;
}
|
The Azkaban Jetty server class
<p>
Global azkaban properties for setup. All of them are optional unless otherwise marked:
azkaban.name - The displayed name of this instance. azkaban.label - Short descriptor of this
Azkaban instance. azkaban.color - Theme color azkaban.temp.dir - Temp dir used by Azkaban for
various file uses. web.resource.dir - The directory that contains the static web files.
default.timezone.id - The timezone code. I.E. America/Los Angeles
<p>
user.manager.class - The UserManager class used for the user manager. Default is XmlUserManager.
project.manager.class - The ProjectManager to load projects project.global.properties - The base
properties inherited by all projects and jobs
<p>
jetty.maxThreads - # of threads for jetty jetty.ssl.port - The ssl port used for sessionizing.
jetty.keystore - Jetty keystore . jetty.keypassword - Jetty keystore password jetty.truststore -
Jetty truststore jetty.trustpassword - Jetty truststore password
|
getInstance
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
public static void main(final String[] args) throws Exception {
// Redirect all std out and err messages into log4j
StdOutErrRedirect.redirectOutAndErrToLog();
logger.info("Starting Jetty Azkaban Web Server...");
final Props props = AzkabanServer.loadProps(args);
if (props == null) {
logger.error("Azkaban Properties not loaded. Exiting..");
System.exit(1);
}
/* Initialize Guice Injector */
final Injector injector = Guice.createInjector(
new AzkabanCommonModule(props),
new AzkabanWebServerModule(props),
new ClusterModule()
);
SERVICE_PROVIDER.setInjector(injector);
launch(injector.getInstance(AzkabanWebServer.class));
}
|
The Azkaban Jetty server class
<p>
Global azkaban properties for setup. All of them are optional unless otherwise marked:
azkaban.name - The displayed name of this instance. azkaban.label - Short descriptor of this
Azkaban instance. azkaban.color - Theme color azkaban.temp.dir - Temp dir used by Azkaban for
various file uses. web.resource.dir - The directory that contains the static web files.
default.timezone.id - The timezone code. I.E. America/Los Angeles
<p>
user.manager.class - The UserManager class used for the user manager. Default is XmlUserManager.
project.manager.class - The ProjectManager to load projects project.global.properties - The base
properties inherited by all projects and jobs
<p>
jetty.maxThreads - # of threads for jetty jetty.ssl.port - The ssl port used for sessionizing.
jetty.keystore - Jetty keystore . jetty.keypassword - Jetty keystore password jetty.truststore -
Jetty truststore jetty.trustpassword - Jetty truststore password
|
main
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
public static void launch(final AzkabanWebServer webServer) throws Exception {
/* This creates the Web Server instance */
app = webServer;
webServer.validateDatabaseVersion();
webServer.prepareAndStartServer();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
if (webServer.props.getBoolean(ENABLE_QUARTZ, false)) {
AzkabanWebServer.logger.info("Shutting down flow trigger scheduler...");
webServer.flowTriggerScheduler.shutdown();
}
} catch (final Exception e) {
AzkabanWebServer.logger.error("Exception while shutting down flow trigger service.", e);
}
try {
if (webServer.props.getBoolean(ENABLE_QUARTZ, false)) {
AzkabanWebServer.logger.info("Shutting down flow trigger service...");
webServer.flowTriggerService.shutdown();
}
} catch (final Exception e) {
AzkabanWebServer.logger.error("Exception while shutting down flow trigger service.", e);
}
try {
AzkabanWebServer.logger.info("Logging top memory consumers...");
logTopMemoryConsumers();
AzkabanWebServer.logger.info("Shutting down http server...");
webServer.close();
} catch (final Exception e) {
AzkabanWebServer.logger.error("Exception while shutting down web server.", e);
}
AzkabanWebServer.logger.info("kk thx bye.");
}
public void logTopMemoryConsumers() throws Exception {
if (new File("/bin/bash").exists() && new File("/bin/ps").exists()
&& new File("/usr/bin/head").exists()) {
AzkabanWebServer.logger.info("logging top memory consumer");
final java.lang.ProcessBuilder processBuilder =
new java.lang.ProcessBuilder("/bin/bash", "-c",
"/bin/ps aux --sort -rss | /usr/bin/head");
final Process p = processBuilder.start();
p.waitFor();
final InputStream is = p.getInputStream();
final java.io.BufferedReader reader =
new java.io.BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
String line = null;
while ((line = reader.readLine()) != null) {
AzkabanWebServer.logger.info(line);
}
is.close();
}
}
});
}
|
The Azkaban Jetty server class
<p>
Global azkaban properties for setup. All of them are optional unless otherwise marked:
azkaban.name - The displayed name of this instance. azkaban.label - Short descriptor of this
Azkaban instance. azkaban.color - Theme color azkaban.temp.dir - Temp dir used by Azkaban for
various file uses. web.resource.dir - The directory that contains the static web files.
default.timezone.id - The timezone code. I.E. America/Los Angeles
<p>
user.manager.class - The UserManager class used for the user manager. Default is XmlUserManager.
project.manager.class - The ProjectManager to load projects project.global.properties - The base
properties inherited by all projects and jobs
<p>
jetty.maxThreads - # of threads for jetty jetty.ssl.port - The ssl port used for sessionizing.
jetty.keystore - Jetty keystore . jetty.keypassword - Jetty keystore password jetty.truststore -
Jetty truststore jetty.trustpassword - Jetty truststore password
|
launch
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Override
public void run() {
try {
if (webServer.props.getBoolean(ENABLE_QUARTZ, false)) {
AzkabanWebServer.logger.info("Shutting down flow trigger scheduler...");
webServer.flowTriggerScheduler.shutdown();
}
} catch (final Exception e) {
AzkabanWebServer.logger.error("Exception while shutting down flow trigger service.", e);
}
try {
if (webServer.props.getBoolean(ENABLE_QUARTZ, false)) {
AzkabanWebServer.logger.info("Shutting down flow trigger service...");
webServer.flowTriggerService.shutdown();
}
} catch (final Exception e) {
AzkabanWebServer.logger.error("Exception while shutting down flow trigger service.", e);
}
try {
AzkabanWebServer.logger.info("Logging top memory consumers...");
logTopMemoryConsumers();
AzkabanWebServer.logger.info("Shutting down http server...");
webServer.close();
} catch (final Exception e) {
AzkabanWebServer.logger.error("Exception while shutting down web server.", e);
}
AzkabanWebServer.logger.info("kk thx bye.");
}
|
The Azkaban Jetty server class
<p>
Global azkaban properties for setup. All of them are optional unless otherwise marked:
azkaban.name - The displayed name of this instance. azkaban.label - Short descriptor of this
Azkaban instance. azkaban.color - Theme color azkaban.temp.dir - Temp dir used by Azkaban for
various file uses. web.resource.dir - The directory that contains the static web files.
default.timezone.id - The timezone code. I.E. America/Los Angeles
<p>
user.manager.class - The UserManager class used for the user manager. Default is XmlUserManager.
project.manager.class - The ProjectManager to load projects project.global.properties - The base
properties inherited by all projects and jobs
<p>
jetty.maxThreads - # of threads for jetty jetty.ssl.port - The ssl port used for sessionizing.
jetty.keystore - Jetty keystore . jetty.keypassword - Jetty keystore password jetty.truststore -
Jetty truststore jetty.trustpassword - Jetty truststore password
|
run
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
public void logTopMemoryConsumers() throws Exception {
if (new File("/bin/bash").exists() && new File("/bin/ps").exists()
&& new File("/usr/bin/head").exists()) {
AzkabanWebServer.logger.info("logging top memory consumer");
final java.lang.ProcessBuilder processBuilder =
new java.lang.ProcessBuilder("/bin/bash", "-c",
"/bin/ps aux --sort -rss | /usr/bin/head");
final Process p = processBuilder.start();
p.waitFor();
final InputStream is = p.getInputStream();
final java.io.BufferedReader reader =
new java.io.BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
String line = null;
while ((line = reader.readLine()) != null) {
AzkabanWebServer.logger.info(line);
}
is.close();
}
}
|
The Azkaban Jetty server class
<p>
Global azkaban properties for setup. All of them are optional unless otherwise marked:
azkaban.name - The displayed name of this instance. azkaban.label - Short descriptor of this
Azkaban instance. azkaban.color - Theme color azkaban.temp.dir - Temp dir used by Azkaban for
various file uses. web.resource.dir - The directory that contains the static web files.
default.timezone.id - The timezone code. I.E. America/Los Angeles
<p>
user.manager.class - The UserManager class used for the user manager. Default is XmlUserManager.
project.manager.class - The ProjectManager to load projects project.global.properties - The base
properties inherited by all projects and jobs
<p>
jetty.maxThreads - # of threads for jetty jetty.ssl.port - The ssl port used for sessionizing.
jetty.keystore - Jetty keystore . jetty.keypassword - Jetty keystore password jetty.truststore -
Jetty truststore jetty.trustpassword - Jetty truststore password
|
logTopMemoryConsumers
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
private static void loadViewerPlugins(final Context root, final String pluginPath,
final VelocityEngine ve) {
final File viewerPluginPath = new File(pluginPath);
if (!viewerPluginPath.exists()) {
return;
}
final ClassLoader parentLoader = AzkabanWebServer.class.getClassLoader();
final File[] pluginDirs = viewerPluginPath.listFiles();
final ArrayList<String> jarPaths = new ArrayList<>();
for (final File pluginDir : pluginDirs) {
// load plugin properties
final Props pluginProps = PropsUtils.loadPluginProps(pluginDir);
if (pluginProps == null) {
continue;
}
final String pluginName = pluginProps.getString("viewer.name");
final String pluginWebPath = pluginProps.getString("viewer.path");
final String pluginJobTypes = pluginProps.getString("viewer.jobtypes", null);
final int pluginOrder = pluginProps.getInt("viewer.order", 0);
final boolean pluginHidden = pluginProps.getBoolean("viewer.hidden", false);
final List<String> extLibClassPaths =
pluginProps.getStringList("viewer.external.classpaths",
(List<String>) null);
final String pluginClass = pluginProps.getString("viewer.servlet.class");
if (pluginClass == null) {
logger.error("Viewer class is not set.");
continue;
} else {
logger.info("Plugin class " + pluginClass);
}
final Class<?> viewerClass =
PluginUtils.getPluginClass(pluginClass, pluginDir, extLibClassPaths, parentLoader);
if (viewerClass == null) {
continue;
}
final String source = FileIOUtils.getSourcePathFromClass(viewerClass);
logger.info("Source jar " + source);
jarPaths.add("jar:file:" + source);
Constructor<?> constructor = null;
try {
constructor = viewerClass.getConstructor(Props.class);
} catch (final NoSuchMethodException e) {
logger.error("Constructor not found in " + pluginClass);
continue;
}
Object obj = null;
try {
obj = constructor.newInstance(pluginProps);
} catch (final Exception e) {
logger.error(e);
logger.error(e.getCause());
}
if (!(obj instanceof AbstractAzkabanServlet)) {
logger.error("The object is not an AbstractAzkabanServlet");
continue;
}
final AbstractAzkabanServlet avServlet = (AbstractAzkabanServlet) obj;
root.addServlet(new ServletHolder(avServlet), "/" + pluginWebPath + "/*");
PluginRegistry.getRegistry().register(
new ViewerPlugin(pluginName, pluginWebPath, pluginOrder,
pluginHidden, pluginJobTypes));
}
// Velocity needs the jar resource paths to be set.
// ...but only when path is not empty! https://github.com/azkaban/azkaban/issues/917
if (!jarPaths.isEmpty()) {
final String jarResourcePath = StringUtils.join(jarPaths, ", ");
logger.info("Setting jar resource path " + jarResourcePath);
ve.addProperty("jar.resource.loader.path", jarResourcePath);
}
}
|
The Azkaban Jetty server class
<p>
Global azkaban properties for setup. All of them are optional unless otherwise marked:
azkaban.name - The displayed name of this instance. azkaban.label - Short descriptor of this
Azkaban instance. azkaban.color - Theme color azkaban.temp.dir - Temp dir used by Azkaban for
various file uses. web.resource.dir - The directory that contains the static web files.
default.timezone.id - The timezone code. I.E. America/Los Angeles
<p>
user.manager.class - The UserManager class used for the user manager. Default is XmlUserManager.
project.manager.class - The ProjectManager to load projects project.global.properties - The base
properties inherited by all projects and jobs
<p>
jetty.maxThreads - # of threads for jetty jetty.ssl.port - The ssl port used for sessionizing.
jetty.keystore - Jetty keystore . jetty.keypassword - Jetty keystore password jetty.truststore -
Jetty truststore jetty.trustpassword - Jetty truststore password
|
loadViewerPlugins
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
public FlowTriggerService getFlowTriggerService() {
return this.flowTriggerService;
}
|
The Azkaban Jetty server class
<p>
Global azkaban properties for setup. All of them are optional unless otherwise marked:
azkaban.name - The displayed name of this instance. azkaban.label - Short descriptor of this
Azkaban instance. azkaban.color - Theme color azkaban.temp.dir - Temp dir used by Azkaban for
various file uses. web.resource.dir - The directory that contains the static web files.
default.timezone.id - The timezone code. I.E. America/Los Angeles
<p>
user.manager.class - The UserManager class used for the user manager. Default is XmlUserManager.
project.manager.class - The ProjectManager to load projects project.global.properties - The base
properties inherited by all projects and jobs
<p>
jetty.maxThreads - # of threads for jetty jetty.ssl.port - The ssl port used for sessionizing.
jetty.keystore - Jetty keystore . jetty.keypassword - Jetty keystore password jetty.truststore -
Jetty truststore jetty.trustpassword - Jetty truststore password
|
getFlowTriggerService
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
public FlowTriggerScheduler getFlowTriggerScheduler() {
return this.flowTriggerScheduler;
}
|
The Azkaban Jetty server class
<p>
Global azkaban properties for setup. All of them are optional unless otherwise marked:
azkaban.name - The displayed name of this instance. azkaban.label - Short descriptor of this
Azkaban instance. azkaban.color - Theme color azkaban.temp.dir - Temp dir used by Azkaban for
various file uses. web.resource.dir - The directory that contains the static web files.
default.timezone.id - The timezone code. I.E. America/Los Angeles
<p>
user.manager.class - The UserManager class used for the user manager. Default is XmlUserManager.
project.manager.class - The ProjectManager to load projects project.global.properties - The base
properties inherited by all projects and jobs
<p>
jetty.maxThreads - # of threads for jetty jetty.ssl.port - The ssl port used for sessionizing.
jetty.keystore - Jetty keystore . jetty.keypassword - Jetty keystore password jetty.truststore -
Jetty truststore jetty.trustpassword - Jetty truststore password
|
getFlowTriggerScheduler
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
private void validateDatabaseVersion() throws IOException, SQLException {
final boolean checkDB = this.props
.getBoolean(AzkabanDatabaseSetup.DATABASE_CHECK_VERSION, false);
if (checkDB) {
final AzkabanDatabaseSetup setup = new AzkabanDatabaseSetup(this.props);
setup.loadTableInfo();
if (setup.needsUpdating()) {
logger.error("Database is out of date.");
setup.printUpgradePlan();
logger.error("Exiting with error.");
System.exit(-1);
}
}
}
|
The Azkaban Jetty server class
<p>
Global azkaban properties for setup. All of them are optional unless otherwise marked:
azkaban.name - The displayed name of this instance. azkaban.label - Short descriptor of this
Azkaban instance. azkaban.color - Theme color azkaban.temp.dir - Temp dir used by Azkaban for
various file uses. web.resource.dir - The directory that contains the static web files.
default.timezone.id - The timezone code. I.E. America/Los Angeles
<p>
user.manager.class - The UserManager class used for the user manager. Default is XmlUserManager.
project.manager.class - The ProjectManager to load projects project.global.properties - The base
properties inherited by all projects and jobs
<p>
jetty.maxThreads - # of threads for jetty jetty.ssl.port - The ssl port used for sessionizing.
jetty.keystore - Jetty keystore . jetty.keypassword - Jetty keystore password jetty.truststore -
Jetty truststore jetty.trustpassword - Jetty truststore password
|
validateDatabaseVersion
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
private void configureRoutes() throws TriggerManagerException {
final Context root = new Context(this.server, "/", Context.SESSIONS);
root.setMaxFormContentSize(MAX_FORM_CONTENT_SIZE);
root.setAttribute(AZKABAN_SERVLET_CONTEXT_KEY, this);
final String staticDir = this.props.getString("web.resource.dir", "");
logger.info("Setting up web resource dir " + staticDir);
root.setResourceBase(staticDir);
final ServletHolder staticServlet = new ServletHolder(new DefaultServlet());
root.addServlet(staticServlet, "/css/*");
root.addServlet(staticServlet, "/js/*");
root.addServlet(staticServlet, "/images/*");
root.addServlet(staticServlet, "/fonts/*");
root.addServlet(staticServlet, "/favicon.ico");
final Map<String, AbstractAzkabanServlet> routesMap = getRoutesMap();
// Configure core routes
for (final Entry<String, AbstractAzkabanServlet> entry : routesMap.entrySet()) {
root.addServlet(new ServletHolder(entry.getValue()), entry.getKey());
}
final ServletHolder restliHolder = new ServletHolder(new RestliServlet());
restliHolder.setInitParameter("resourcePackages", "azkaban.restli");
root.addServlet(restliHolder, "/restli/*");
final String viewerPluginDir =
this.props.getString("viewer.plugin.dir", "plugins/viewer");
loadViewerPlugins(root, viewerPluginDir, getVelocityEngine());
// Trigger Plugin Loader
final TriggerPluginLoader triggerPluginLoader = new TriggerPluginLoader(this.props);
final Map<String, TriggerPlugin> triggerPlugins = triggerPluginLoader.loadTriggerPlugins(root);
setTriggerPlugins(triggerPlugins);
// always have basic time trigger
// TODO: find something else to do the job
getTriggerManager().start();
getScheduleManager().start();
// Set up api endpoint metrics
// At the moment login action doesn't have a dedicated route, any route can be used to
// authenticate when passing the right parameters. The same metrics object is used for login
// requests on every route.
final AzkabanAPIMetrics loginAPIMetrics = this.webMetrics.setUpAzkabanAPIMetrics(
"_action-" + LoginAbstractAzkabanServlet.getLoginAPI().getParameterValue());
LoginAbstractAzkabanServlet.getLoginAPI().setMetrics(loginAPIMetrics);
for (final Entry<String, AbstractAzkabanServlet> entry : routesMap.entrySet()) {
final List<AzkabanAPI> servletApiEndpoints = entry.getValue().getApiEndpoints();
for (final AzkabanAPI api : servletApiEndpoints) {
final String uri = entry.getKey().replace("/", "") + "_" + api.getRequestParameter() +
(api.getParameterValue().isEmpty() ? "" : "-" + api.getParameterValue());
api.setMetrics(this.webMetrics.setUpAzkabanAPIMetrics(uri));
}
}
// Configure api metrics filter
final FilterHolder metricsFilter = new FilterHolder(new APIMetricsFilter(routesMap));
final FilterMapping metricsFilterMapping = new FilterMapping();
metricsFilterMapping.setFilterName(metricsFilter.getName());
final String[] servletPaths = routesMap.keySet().stream().toArray(String[]::new);
metricsFilterMapping.setPathSpecs(servletPaths);
metricsFilterMapping.setDispatches(Handler.REQUEST);
root.getServletHandler().addFilter(metricsFilter, metricsFilterMapping);
}
|
The Azkaban Jetty server class
<p>
Global azkaban properties for setup. All of them are optional unless otherwise marked:
azkaban.name - The displayed name of this instance. azkaban.label - Short descriptor of this
Azkaban instance. azkaban.color - Theme color azkaban.temp.dir - Temp dir used by Azkaban for
various file uses. web.resource.dir - The directory that contains the static web files.
default.timezone.id - The timezone code. I.E. America/Los Angeles
<p>
user.manager.class - The UserManager class used for the user manager. Default is XmlUserManager.
project.manager.class - The ProjectManager to load projects project.global.properties - The base
properties inherited by all projects and jobs
<p>
jetty.maxThreads - # of threads for jetty jetty.ssl.port - The ssl port used for sessionizing.
jetty.keystore - Jetty keystore . jetty.keypassword - Jetty keystore password jetty.truststore -
Jetty truststore jetty.trustpassword - Jetty truststore password
|
configureRoutes
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@VisibleForTesting
protected Map<String, AbstractAzkabanServlet> getRoutesMap() {
final String defaultServletPath =
this.props.getString("azkaban.default.servlet.path", "/index");
final Map<String, AbstractAzkabanServlet> routesMap = new HashMap<>();
routesMap.put("/index", new ProjectServlet());
routesMap.put("/manager", new ProjectManagerServlet());
routesMap.put("/executor", new ExecutorServlet());
routesMap.put("/schedule", new ScheduleServlet());
routesMap.put("/triggers", new TriggerManagerServlet());
routesMap.put("/flowtrigger", new FlowTriggerServlet());
routesMap.put("/flowtriggerinstance", new FlowTriggerInstanceServlet());
routesMap.put("/history", new HistoryServlet());
routesMap.put("/jmx", new JMXHttpServlet());
routesMap.put("/stats", new StatsServlet());
routesMap.put("/notes", new NoteServlet());
routesMap.put("/", new IndexRedirectServlet(defaultServletPath));
routesMap.put("/status", new StatusServlet(this.statusService));
if (isContainerizedDispatchMethodEnabled()) {
routesMap.put("/imageTypes/*", new ImageTypeServlet());
routesMap.put("/imageVersions/*", new ImageVersionServlet());
routesMap.put("/imageRampup/*", new ImageRampupServlet());
routesMap.put("/imageRampRule/*", new ImageRampRuleServlet());
}
return routesMap;
}
|
@return The routing map of path to servlets.
|
getRoutesMap
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
private boolean isContainerizedDispatchMethodEnabled() {
return DispatchMethod.isContainerizedMethodEnabled(this.props
.getString(Constants.ConfigurationKeys.AZKABAN_EXECUTION_DISPATCH_METHOD,
DispatchMethod.PUSH.name()));
}
|
@return True if the Containerization is enabled, otherwise false.
|
isContainerizedDispatchMethodEnabled
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
private void prepareAndStartServer() throws Exception {
this.executorManagerAdapter.start();
this.executionLogsCleaner.start();
this.missedSchedulesManager.start();
configureRoutes();
startWebMetrics();
startContainerMetrics();
this.containerCleanupManager.ifPresent(ContainerCleanupManager::start);
if (this.props.getBoolean(ENABLE_QUARTZ, false)) {
// flowTriggerService needs to be started first before scheduler starts to schedule
// existing flow triggers
logger.info("Starting flow trigger service");
this.flowTriggerService.start();
logger.info("Starting flow trigger scheduler");
this.flowTriggerScheduler.start();
}
try {
this.server.start();
logger.info("Server started");
} catch (final Exception e) {
logger.warn(e);
Utils.croak(e.getMessage(), 1);
}
}
|
@return True if the Containerization is enabled, otherwise false.
|
prepareAndStartServer
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
private void startWebMetrics() {
final QueuedThreadPool queuedThreadPool = (QueuedThreadPool) this.server.getThreadPool();
final ExecutorManagerAdapter executorManagerAdapter = this.executorManagerAdapter;
final SessionCache sessionCache = this.sessionCache;
final int minAgeForClassifyingAFlowAged = this.props.getInt(
ConfigurationKeys.MIN_AGE_FOR_CLASSIFYING_A_FLOW_AGED_MINUTES,
Constants.DEFAULT_MIN_AGE_FOR_CLASSIFYING_A_FLOW_AGED_MINUTES);
if (minAgeForClassifyingAFlowAged < 0) {
logger.error(String.format("Property config file contains a value of %d for %s. "
+ "Metric NumAgedQueuedFlows is emitted only when this value is non-negative.",
minAgeForClassifyingAFlowAged,
ConfigurationKeys.MIN_AGE_FOR_CLASSIFYING_A_FLOW_AGED_MINUTES));
}
this.webMetrics.setUp(new WebMetrics.DataProvider() {
@Override
public int getNumberOfIdleServerThreads() {
// The number of idle threads in Jetty thread pool
return queuedThreadPool.getIdleThreads();
}
@Override
public int getNumberOfServerThreads() {
// The number of threads in Jetty thread pool. The formula is:
// threads = idleThreads + busyThreads
return queuedThreadPool.getThreads();
}
@Override
public int getServerJobsQueueSize() {
// The number of requests queued in the Jetty thread pool.
return queuedThreadPool.getQueueSize();
}
@Override
public long getNumberOfQueuedFlows() {
return executorManagerAdapter.getQueuedFlowSize();
}
@Override
public int getNumberOfRunningFlows() {
/*
* TODO: Currently {@link ExecutorManager#getRunningFlows()} includes both running and
* non-dispatched flows. Originally we would like to do a subtraction between
* getRunningFlows and {@link ExecutorManager#getQueuedFlowSize()}, in order to have the
* correct runnable flows. However, both getRunningFlows and getQueuedFlowSize are not
* synchronized, such that we can not make a thread safe subtraction. We need to fix this
* in the future.
*/
return executorManagerAdapter.getRunningFlowIds().size();
}
@Override
public long getNumberOfCurrentSessions() {
// Metric for flows that have been submitted, but haven't started for more than N minutes
// (N is configurable by MIN_AGE_FOR_CLASSIFYING_A_FLOW_AGED_MINUTES).
return sessionCache.getSessionCount();
}
@Override
public long getNumberOfAgedQueuedFlows() {
return executorManagerAdapter.getAgedQueuedFlowSize();
}
});
this.webMetrics.startReporting(this.props);
}
|
@return True if the Containerization is enabled, otherwise false.
|
startWebMetrics
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Override
public int getNumberOfIdleServerThreads() {
// The number of idle threads in Jetty thread pool
return queuedThreadPool.getIdleThreads();
}
|
@return True if the Containerization is enabled, otherwise false.
|
getNumberOfIdleServerThreads
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Override
public int getNumberOfServerThreads() {
// The number of threads in Jetty thread pool. The formula is:
// threads = idleThreads + busyThreads
return queuedThreadPool.getThreads();
}
|
@return True if the Containerization is enabled, otherwise false.
|
getNumberOfServerThreads
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Override
public int getServerJobsQueueSize() {
// The number of requests queued in the Jetty thread pool.
return queuedThreadPool.getQueueSize();
}
|
@return True if the Containerization is enabled, otherwise false.
|
getServerJobsQueueSize
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Override
public long getNumberOfQueuedFlows() {
return executorManagerAdapter.getQueuedFlowSize();
}
|
@return True if the Containerization is enabled, otherwise false.
|
getNumberOfQueuedFlows
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Override
public int getNumberOfRunningFlows() {
/*
* TODO: Currently {@link ExecutorManager#getRunningFlows()} includes both running and
* non-dispatched flows. Originally we would like to do a subtraction between
* getRunningFlows and {@link ExecutorManager#getQueuedFlowSize()}, in order to have the
* correct runnable flows. However, both getRunningFlows and getQueuedFlowSize are not
* synchronized, such that we can not make a thread safe subtraction. We need to fix this
* in the future.
*/
return executorManagerAdapter.getRunningFlowIds().size();
}
|
@return True if the Containerization is enabled, otherwise false.
|
getNumberOfRunningFlows
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Override
public long getNumberOfCurrentSessions() {
// Metric for flows that have been submitted, but haven't started for more than N minutes
// (N is configurable by MIN_AGE_FOR_CLASSIFYING_A_FLOW_AGED_MINUTES).
return sessionCache.getSessionCount();
}
|
@return True if the Containerization is enabled, otherwise false.
|
getNumberOfCurrentSessions
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Override
public long getNumberOfAgedQueuedFlows() {
return executorManagerAdapter.getAgedQueuedFlowSize();
}
|
@return True if the Containerization is enabled, otherwise false.
|
getNumberOfAgedQueuedFlows
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
private void startContainerMetrics() {
this.containerizationMetrics.setUp();
this.containerizationMetrics.startReporting(this.props);
}
|
Set up and start reporting container metrics
|
startContainerMetrics
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
private void loadBuiltinCheckersAndActions() {
logger.info("Loading built-in checker and action types");
ExecuteFlowAction.setExecutorManager(this.executorManagerAdapter);
ExecuteFlowAction.setProjectManager(this.projectManager);
ExecuteFlowAction.setTriggerManager(this.triggerManager);
KillExecutionAction.setExecutorManager(this.executorManagerAdapter);
CreateTriggerAction.setTriggerManager(this.triggerManager);
ExecutionChecker.setExecutorManager(this.executorManagerAdapter);
this.triggerManager.registerCheckerType(BasicTimeChecker.type, BasicTimeChecker.class);
this.triggerManager.registerCheckerType(SlaChecker.type, SlaChecker.class);
this.triggerManager.registerCheckerType(ExecutionChecker.type, ExecutionChecker.class);
this.triggerManager.registerActionType(ExecuteFlowAction.type, ExecuteFlowAction.class);
this.triggerManager.registerActionType(KillExecutionAction.type, KillExecutionAction.class);
this.triggerManager.registerActionType(SlaAlertAction.type, SlaAlertAction.class);
this.triggerManager.registerActionType(CreateTriggerAction.type, CreateTriggerAction.class);
}
|
Set up and start reporting container metrics
|
loadBuiltinCheckersAndActions
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Override
public VelocityEngine getVelocityEngine() {
return this.velocityEngine;
}
|
Returns the velocity engine for pages to use.
|
getVelocityEngine
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Override
public UserManager getUserManager() {
return this.userManager;
}
|
Returns the velocity engine for pages to use.
|
getUserManager
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
public ProjectManager getProjectManager() {
return this.projectManager;
}
|
Returns the velocity engine for pages to use.
|
getProjectManager
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
public ExecutorManagerAdapter getExecutorManager() {
return this.executorManagerAdapter;
}
|
Returns the velocity engine for pages to use.
|
getExecutorManager
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
public ScheduleManager getScheduleManager() {
return this.scheduleManager;
}
|
Returns the velocity engine for pages to use.
|
getScheduleManager
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
public TriggerManager getTriggerManager() {
return this.triggerManager;
}
|
Returns the velocity engine for pages to use.
|
getTriggerManager
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
public WebMetrics getWebMetrics() {
return this.webMetrics;
}
|
Returns the velocity engine for pages to use.
|
getWebMetrics
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServer.java
|
Apache-2.0
|
@Provides
@Singleton
public FlowTriggerDependencyPluginManager getDependencyPluginManager(final Props props)
throws FlowTriggerDependencyPluginException {
//todo chengren311: disable requireNonNull for now in beta since dependency plugin dir is not
// required. Add it back when flow trigger feature is enabled in production
String dependencyPluginDir;
try {
dependencyPluginDir = props.getString(ConfigurationKeys.DEPENDENCY_PLUGIN_DIR);
} catch (final Exception ex) {
dependencyPluginDir = null;
}
return new FlowTriggerDependencyPluginManager(dependencyPluginDir);
}
|
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.
|
getDependencyPluginManager
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
@Override
protected void configure() {
bind(Server.class).toProvider(WebServerProvider.class);
bind(ScheduleLoader.class).to(TriggerBasedScheduleLoader.class);
bind(FlowTriggerInstanceLoader.class).to(JdbcFlowTriggerInstanceLoaderImpl.class);
bind(ExecutorManagerAdapter.class).to(resolveExecutorManagerAdaptorClassType());
bind(WebMetrics.class).to(resolveWebMetricsClass()).in(Scopes.SINGLETON);
bind(EventListener.class).to(resolveEventListenerClass()).in(Scopes.SINGLETON);
// Implement container metrics based on dispatch method
bind(ContainerizationMetrics.class).to(resolveContainerMetricsClass()).in(Scopes.SINGLETON);
// Following bindings will be present if and only if containerized dispatch is enabled.
bindImageManagementDependencies();
bindContainerWatchDependencies();
bindContainerCleanupManager();
bindOnExecutionEventListener();
// Workaround to support the transition from bare metal executions using the POLL dispatch
// model to containerized executions. In that mixed environment cleanup logics to handle stuck
// executions for both CONTAINERIZED and POLL dispatch models are needed.
bindExecutorHealthCheckerForContainerization();
}
|
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-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private Class<? extends ContainerizationMetrics> resolveContainerMetricsClass() {
return isContainerizedDispatchMethodEnabled() ? ContainerizationMetricsImpl.class :
DummyContainerizationMetricsImpl.class;
}
|
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.
|
resolveContainerMetricsClass
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private Class<? extends EventListener> resolveEventListenerClass() {
return FlowStatusChangeEventListener.class;
}
|
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.
|
resolveEventListenerClass
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private Class<? extends ContainerizedImpl> resolveContainerizedImpl() {
final String containerizedImplProperty =
props.getString(ContainerizedDispatchManagerProperties.CONTAINERIZED_IMPL_TYPE,
ContainerizedImplType.KUBERNETES.name())
.toUpperCase();
return ContainerizedImplType.valueOf(containerizedImplProperty).getImplClass();
}
|
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.
|
resolveContainerizedImpl
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private Class<? extends ExecutorManagerAdapter> resolveExecutorManagerAdaptorClassType() {
switch (DispatchMethod.getDispatchMethod(this.props
.getString(Constants.ConfigurationKeys.AZKABAN_EXECUTION_DISPATCH_METHOD,
DispatchMethod.PUSH.name()))) {
case POLL:
return ExecutionController.class;
case CONTAINERIZED:
bind(VPARecommender.class).to(KubernetesVPARecommender.class);
bind(ContainerizedImpl.class).to(resolveContainerizedImpl());
bind(ContainerizedWatch.class).to(KubernetesWatch.class);
return ContainerizedDispatchManager.class;
case PUSH:
default:
return ExecutorManager.class;
}
}
|
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.
|
resolveExecutorManagerAdaptorClassType
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private Class<? extends WebMetrics> resolveWebMetricsClass() {
return this.props.getBoolean(ConfigurationKeys.IS_METRICS_ENABLED, false) ? WebMetricsImpl.class
: DummyWebMetricsImpl.class;
}
|
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.
|
resolveWebMetricsClass
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private void bindImageManagementDependencies() {
if(isContainerizedDispatchMethodEnabled()) {
bind(ImageTypeService.class).to(ImageTypeServiceImpl.class).in(Scopes.SINGLETON);
bind(ImageVersionService.class).to(ImageVersionServiceImpl.class).in(Scopes.SINGLETON);
bind(ImageRampupService.class).to(ImageRampupServiceImpl.class).in(Scopes.SINGLETON);
bind(VersionSetLoader.class).to(JdbcVersionSetLoader.class).in(Scopes.SINGLETON);
bind(ImageVersionMetadataService.class).to(ImageVersionMetadataServiceImpl.class).in(Scopes.SINGLETON);
bind(ImageMgmtCommonService.class).to(ImageMgmtCommonServiceImpl.class).in(Scopes.SINGLETON);
bind(ImageRampRuleService.class).to(ImageRampRuleServiceImpl.class).in(Scopes.SINGLETON);
bind(PermissionManager.class).to(PermissionManagerImpl.class).in(Scopes.SINGLETON);
}
}
|
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.
|
bindImageManagementDependencies
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private boolean isContainerizedDispatchMethodEnabled() {
return DispatchMethod.isContainerizedMethodEnabled(props
.getString(Constants.ConfigurationKeys.AZKABAN_EXECUTION_DISPATCH_METHOD,
DispatchMethod.PUSH.name()));
}
|
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.
|
isContainerizedDispatchMethodEnabled
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private void bindContainerWatchDependencies() {
if(!isContainerizedDispatchMethodEnabled()) {
bind(ContainerizedImpl.class).toProvider(Providers.of(null));
return;
}
log.info("Binding kubernetes watch dependencies");
bind(KubernetesWatch.class).in(Scopes.SINGLETON);
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
bindContainerWatchDependencies
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private void bindContainerCleanupManager() {
if(!isContainerizedDispatchMethodEnabled()) {
bind(ContainerCleanupManager.class).toProvider(Providers.of(null));
return;
}
log.info("Binding ContainerCleanupManager");
bind(ContainerCleanupManager.class).in(Scopes.SINGLETON);
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
bindContainerCleanupManager
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private void bindExecutorHealthCheckerForContainerization() {
// {@link azkaban.executor.ExecutorHealthChecker} binding should only happen if
// {@link azkaban.DispatchMethod.CONTAINERIZED} dispatch model is enabled and below properties are defined.
if(isContainerizedDispatchMethodEnabled()) {
if(!this.props.getString(
ConfigurationKeys.AZKABAN_EXECUTOR_HEALTHCHECK_INTERVAL_MIN, "").isEmpty() &&
!this.props.getString(
ConfigurationKeys.AZKABAN_EXECUTOR_MAX_FAILURE_COUNT, "").isEmpty()) {
log.info("Binding ExecutorHealthChecker");
bind(ExecutorHealthChecker.class).in(Scopes.SINGLETON);
} else {
bind(ExecutorHealthChecker.class).toProvider(Providers.of(null));
}
}
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
bindExecutorHealthCheckerForContainerization
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
private void bindOnExecutionEventListener() {
if(!isContainerizedDispatchMethodEnabled()) {
bind(OnExecutionEventListener.class).toProvider(Providers.of(null));
return;
}
log.info("Binding OnExecutionEventListener");
bind(OnExecutionEventListener.class).to(OnContainerizedExecutionEventListener.class).in(Scopes.SINGLETON);
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
bindOnExecutionEventListener
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
@Inject
@Singleton
@Provides
private RawPodWatchEventListener createStatusDrivingListener(final Props azkProps,
@Named(FLOW_POD_MONITOR) AzPodStatusListener flowPodMonitorListener,
@Named(CONTAINER_STATUS_METRICS_HANDLER) AzPodStatusListener containerStatusMetricsHandlerListener) {
AzPodStatusDrivingListener listener = new AzPodStatusDrivingListener(azkProps);
listener.registerAzPodStatusListener(flowPodMonitorListener);
listener.registerAzPodStatusListener(containerStatusMetricsHandlerListener);
return listener;
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
createStatusDrivingListener
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
@Inject
@Named(FLOW_POD_MONITOR)
@Singleton
@Provides
private AzPodStatusListener createFlowPodMonitoringListener(
final Props azkProps,
final ProjectManager projectManager,
final ContainerizedImpl containerizedImpl,
final ExecutorLoader executorLoader,
final AlerterHolder alerterHolder, final ContainerizationMetrics containerizationMetrics,
final EventListener eventListener) {
return new FlowStatusManagerListener(azkProps, projectManager, containerizedImpl,
executorLoader, alerterHolder,
containerizationMetrics, eventListener);
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
createFlowPodMonitoringListener
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
@Inject
@Named(CONTAINER_STATUS_METRICS_HANDLER)
@Singleton
@Provides
private AzPodStatusListener createContainerStatusMetricsHandlerListener(
ContainerizationMetrics containerizationMetrics) {
return new ContainerStatusMetricsListener(containerizationMetrics);
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
createContainerStatusMetricsHandlerListener
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
@Inject
@Singleton
@Provides
private ApiClient createContainerApiClient(final Props azkProps) {
return WatchUtils.createApiClient(azkProps);
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
createContainerApiClient
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
@Inject
@Singleton
@Provides
private PodWatchParams createPodWatchParams(final Props azkProps) {
return WatchUtils.createPodWatchParams(azkProps);
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
createPodWatchParams
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
@Inject
@Singleton
@Provides
public UserManager createUserManager(final Props props) {
final Class<?> userManagerClass = props.getClass(USER_MANAGER_CLASS_PARAM, null);
final UserManager manager;
if (userManagerClass != null && userManagerClass.getConstructors().length > 0) {
log.info("Loading user manager class " + userManagerClass.getName());
try {
final Constructor<?> userManagerConstructor = userManagerClass.getConstructor(Props.class);
manager = (UserManager) userManagerConstructor.newInstance(props);
} catch (final Exception e) {
log.error("Could not instantiate UserManager " + userManagerClass.getName());
throw new RuntimeException(e);
}
} else {
manager = new XmlUserManager(props);
}
return manager;
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
createUserManager
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
@Inject
@Singleton
@Provides
public VelocityEngine createVelocityEngine(final Props props) {
final boolean devMode = props.getBoolean(VELOCITY_DEV_MODE_PARAM, false);
final VelocityEngine engine = new VelocityEngine();
engine.setProperty("resource.loader", "classpath, jar");
engine.setProperty("classpath.resource.loader.class",
ClasspathResourceLoader.class.getName());
engine.setProperty("classpath.resource.loader.cache", !devMode);
engine.setProperty("classpath.resource.loader.modificationCheckInterval",
5L);
engine.setProperty("jar.resource.loader.class",
JarResourceLoader.class.getName());
engine.setProperty("jar.resource.loader.cache", !devMode);
engine.setProperty("resource.manager.logwhenfound", false);
engine.setProperty("input.encoding", "UTF-8");
engine.setProperty("output.encoding", "UTF-8");
engine.setProperty("directive.set.null.allowed", true);
engine.setProperty("resource.manager.logwhenfound", false);
engine.setProperty("velocimacro.permissions.allow.inline", true);
engine.setProperty("velocimacro.library.autoreload", devMode);
engine.setProperty("velocimacro.library",
"/azkaban/webapp/servlet/velocity/macros.vm");
engine.setProperty(
"velocimacro.permissions.allow.inline.to.replace.global", true);
engine.setProperty("velocimacro.arguments.strict", true);
engine.setProperty("runtime.log.invalid.references", devMode);
engine.setProperty("runtime.log.logsystem.log4j.logger",
Logger.getLogger("org.apache.velocity.Logger"));
engine.setProperty("parser.pool.size", 3);
engine.setProperty("space.gobbling", "bc");
engine.setProperty("directive.if.emptycheck", false);
return engine;
}
|
Binds container watch dependencies based on the dispatch method.
Hack Alert: This binding to a 'null' provider in the if-condition is hacky.
This was a required to satisfy the {@code ContainerizedImpl} dependency when the
dispatch method is not containerized. The field is injected in one of the listener
providing methods {@link createFlowPodMonitoringListener}.
The binding is still safe as AzPodStatusListener will never be injected when
containerized dispatch is not enabled.
Fix: The way conditional bindings are currently defined in this module is an anti-pattern in
guice: https://github.com/google/guice/wiki/AvoidConditionalLogicInModules
A more comprehensive fix should split the dispatch-method based bindings into different
modules.
|
createVelocityEngine
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/AzkabanWebServerModule.java
|
Apache-2.0
|
public Map<Integer, Executor> getExecutorStatusMap() {
return executorStatusMap;
}
|
This POJO is used by GSON library to create a status JSON object. This class represents status
for azkaban cluster.
|
getExecutorStatusMap
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/ClusterStatus.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/ClusterStatus.java
|
Apache-2.0
|
public Map<String, ImageVersionMetadataResponseDTO> getImageTypeVersionMap() {
return imageTypeVersionMap;
}
|
This POJO is used by GSON library to create a status JSON object. This class represents status
for containerized cluster.
|
getImageTypeVersionMap
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/ContainerizedClusterStatus.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/ContainerizedClusterStatus.java
|
Apache-2.0
|
public String getCSRFTokenFromSession(Session session) {
if (null == session || StringUtils.isEmpty(session.getSessionId())) {
return null;
}
String sessionId = session.getSessionId();
return getCSRFTokenFromSessionId(sessionId);
}
|
@param session containing session-id
@return CSRF token derived from session-id
|
getCSRFTokenFromSession
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
Apache-2.0
|
private String getCSRFTokenFromSessionId(String sessionId) {
byte[] bytes;
try {
bytes = sessionId.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
logger.info("Unable to convert sessionId to bytes", e);
return null;
}
byte[] hashedSessionId = this.hashFunction.doFinal(bytes);
return Base64.getEncoder().encodeToString(hashedSessionId);
}
|
@param sessionId
@return CSRF token derived from session-id
|
getCSRFTokenFromSessionId
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
Apache-2.0
|
private static byte[] getSecretKey() {
Random randomGen = new Random();
byte[] secretKey = new byte[8];
randomGen.nextBytes(secretKey);
return secretKey;
}
|
@return Eight bytes SecretKey to be used for initializing HmacSHA256
|
getSecretKey
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
Apache-2.0
|
private void initHashFunction() throws NoSuchAlgorithmException, InvalidKeyException {
byte[] secretKey = getSecretKey();
initHashFunction(secretKey);
}
|
@return Eight bytes SecretKey to be used for initializing HmacSHA256
|
initHashFunction
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
Apache-2.0
|
private void initHashFunction(byte[] secretKey)
throws NoSuchAlgorithmException, InvalidKeyException {
Mac mac = Mac.getInstance(ALGORITHM);
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey, ALGORITHM);
mac.init(secretKeySpec);
this.hashFunction = mac;
}
|
@return Eight bytes SecretKey to be used for initializing HmacSHA256
|
initHashFunction
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
Apache-2.0
|
public boolean validateCSRFToken(String sessionId, String csrfTokenFromRequest) {
String csrfTokenFromSessionId = getCSRFTokenFromSessionId(sessionId);
if (StringUtils.isEmpty(csrfTokenFromSessionId)) {
return false;
}
return csrfTokenFromRequest.equals(csrfTokenFromSessionId);
}
|
@param sessionId
@param csrfTokenFromRequest
@return True if the csrfTokenFromRequest matches with the CSRFToken generated from session-id,
otherwise false
|
validateCSRFToken
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/CSRFTokenUtility.java
|
Apache-2.0
|
public String getVersion() {
return version;
}
|
This is an abstract class for representing azkaban common status.
|
getVersion
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
Apache-2.0
|
public String getPid() {
return pid;
}
|
This is an abstract class for representing azkaban common status.
|
getPid
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
Apache-2.0
|
public String getInstallationPath() {
return installationPath;
}
|
This is an abstract class for representing azkaban common status.
|
getInstallationPath
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
Apache-2.0
|
public long getUsedMemory() {
return usedMemory;
}
|
This is an abstract class for representing azkaban common status.
|
getUsedMemory
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
Apache-2.0
|
public long getXmx() {
return xmx;
}
|
This is an abstract class for representing azkaban common status.
|
getXmx
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
Apache-2.0
|
public boolean isDatabaseUp() {
return isDatabaseUp;
}
|
This is an abstract class for representing azkaban common status.
|
isDatabaseUp
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/Status.java
|
Apache-2.0
|
public Status getStatus() {
if (isContainerizedDispatchMethodEnabled()) {
return getContainerizedStatus();
}
return getClusterStatus();
}
|
Gets the status of the azkaban cluster.
@return Status
|
getStatus
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
Apache-2.0
|
private Status getClusterStatus() {
// Build the status object
return new ClusterStatus(getVersion(),
getPid(),
getInstallationPath(),
getUsedMemory(),
getMaxMemory(),
getDbStatus(),
getActiveExecutors());
}
|
This returns implementation instance for Status containing status information for Azkaban
cluster pertaining to web server, memory, active executors etc.
@return Status
|
getClusterStatus
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
Apache-2.0
|
private Status getContainerizedStatus() {
// Build the status object
ContainerizedDispatchManager containerizedDispatchManager = getContainerizedDispatchManager();
return new ContainerizedClusterStatus(getVersion(),
getPid(),
getInstallationPath(),
getUsedMemory(),
getMaxMemory(),
getDbStatus(),
getStringImageVersionMetadataResponseDTOMap(),
getActiveExecutors(),
containerizedDispatchManager.getContainerRampUpCriteria().getRampUp(),
containerizedDispatchManager.getContainerJobTypeCriteria().getAllowListAsString(),
containerizedDispatchManager.getContainerProxyUserCriteria().getDenyListAsString());
}
|
This returns implementation instance for Status containing cluster status information for
Azkaban containerization. It includes information pertaining to web server, memory and
containerization information such as image types and version for each image types selected
based on either random rampup or latest active image version.
@return Status
|
getContainerizedStatus
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
Apache-2.0
|
@VisibleForTesting
long getUsedMemory() {
final Runtime runtime = Runtime.getRuntime();
return runtime.totalMemory() - runtime.freeMemory();
}
|
This returns implementation instance for Status containing cluster status information for
Azkaban containerization. It includes information pertaining to web server, memory and
containerization information such as image types and version for each image types selected
based on either random rampup or latest active image version.
@return Status
|
getUsedMemory
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
Apache-2.0
|
@VisibleForTesting
long getMaxMemory() {
final Runtime runtime = Runtime.getRuntime();
return runtime.maxMemory();
}
|
This returns implementation instance for Status containing cluster status information for
Azkaban containerization. It includes information pertaining to web server, memory and
containerization information such as image types and version for each image types selected
based on either random rampup or latest active image version.
@return Status
|
getMaxMemory
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
Apache-2.0
|
private Map<String, ImageVersionMetadataResponseDTO> getStringImageVersionMetadataResponseDTOMap() {
Map<String, ImageVersionMetadataResponseDTO> imageTypeVersionMap = new TreeMap<>();
try {
imageTypeVersionMap =
this.getImageVersionMetadataService().
getVersionMetadataForAllImageTypes();
} catch (final Exception ex) {
log.error("Error while geting version metadata for all the image types", ex);
}
return imageTypeVersionMap;
}
|
This returns implementation instance for Status containing cluster status information for
Azkaban containerization. It includes information pertaining to web server, memory and
containerization information such as image types and version for each image types selected
based on either random rampup or latest active image version.
@return Status
|
getStringImageVersionMetadataResponseDTOMap
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
Apache-2.0
|
@VisibleForTesting
String getVersion() {
return jarVersion == null ? "unknown" : jarVersion;
}
|
This returns implementation instance for Status containing cluster status information for
Azkaban containerization. It includes information pertaining to web server, memory and
containerization information such as image types and version for each image types selected
based on either random rampup or latest active image version.
@return Status
|
getVersion
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
Apache-2.0
|
private ImageVersionMetadataService getImageVersionMetadataService() {
return SERVICE_PROVIDER.getInstance(ImageVersionMetadataService.class);
}
|
This returns implementation instance for Status containing cluster status information for
Azkaban containerization. It includes information pertaining to web server, memory and
containerization information such as image types and version for each image types selected
based on either random rampup or latest active image version.
@return Status
|
getImageVersionMetadataService
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
Apache-2.0
|
private ContainerizedDispatchManager getContainerizedDispatchManager() {
return (ContainerizedDispatchManager) SERVICE_PROVIDER
.getInstance(ExecutorManagerAdapter.class);
}
|
This returns implementation instance for Status containing cluster status information for
Azkaban containerization. It includes information pertaining to web server, memory and
containerization information such as image types and version for each image types selected
based on either random rampup or latest active image version.
@return Status
|
getContainerizedDispatchManager
|
java
|
azkaban/azkaban
|
azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/StatusService.java
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.