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 ExecutableFlow createFlowWithMultipleJobtypes() throws Exception { return TestUtils.createTestExecutableFlowFromYaml("embedded4", "valid_dag_2"); }
Test get execution id set from pod list @throws Exception
createFlowWithMultipleJobtypes
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
Apache-2.0
private static void setupImageTables() { imageTypeDao = new ImageTypeDaoImpl(dbOperator); imageVersionDao = new ImageVersionDaoImpl(dbOperator, imageTypeDao); imageRampupDao = new ImageRampupDaoImpl(dbOperator, imageTypeDao, imageVersionDao); // Create a mock of ImageRampupManager to get the image type ...
Test get execution id set from pod list @throws Exception
setupImageTables
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
Apache-2.0
private static void addImageTypeTableEntry(final String jsonFile, final ObjectMapper objectMapper) { final String jsonPayload = JSONUtils.readJsonFileAsString(TEST_JSON_DIR + "/" + jsonFile); try { final ImageTypeDTO imageType = objectMapper.readValue(jsonPayload, ImageTypeDTO.class); imageTyp...
Test get execution id set from pod list @throws Exception
addImageTypeTableEntry
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
Apache-2.0
private static void addImageVersions(final String jsonFile, final ObjectMapper objectMapper) { final String jsonPayload = JSONUtils.readJsonFileAsString(TEST_JSON_DIR + "/" + jsonFile); List<ImageVersionDTO> imageVersions = null; try { imageVersions = objectMapper.readValue(jsonPayload, new ...
Test get execution id set from pod list @throws Exception
addImageVersions
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
Apache-2.0
private static void addImageRampupEntries(final String jsonFile, final ObjectMapper objectMapper) { final String jsonPayload = JSONUtils.readJsonFileAsString(TEST_JSON_DIR + "/" + jsonFile); List<ImageRampupPlanRequestDTO> imageRampupPlanRequests = null; try { imageRampupPlanRequests = objectMap...
Test get execution id set from pod list @throws Exception
addImageRampupEntries
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
Apache-2.0
private Map<String, VersionInfo> getVersionMap() { final Map<String, VersionInfo> versionMap = new TreeMap<>(); versionMap.put(KubernetesContainerizedImpl.DEFAULT_AZKABAN_BASE_IMAGE_NAME, new VersionInfo("7.0.4", "path1", State.ACTIVE)); versionMap.put(KubernetesContainerizedImpl.DEFAULT_AZKABAN_CON...
Creates a version map, which contains key value pairs of image name and corresponding version number @return a version set map
getVersionMap
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
Apache-2.0
private Injector getInjector(final Props props) { props.put(AZKABAN_EVENT_REPORTING_ENABLED, "true"); props.put(AZKABAN_EVENT_REPORTING_CLASS_PARAM, "azkaban.project.AzkabanEventReporterTest"); props.put("database.type", "h2"); props.put("h2.path", "h2"); return Guice.createInjector(new Azka...
Creates a Guice injector for Azkaban event reporter instantiation @param props @return
getInjector
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/KubernetesContainerizedImplTest.java
Apache-2.0
@Before public void setUp() throws Exception { this.defaultApiClient = Config.defaultClient(); ExecutionControllerUtils.onExecutionEventListener = onExecutionEventListener; final FlowResourceRecommendation flowResourceRecommendation = new FlowResourceRecommendation(1, project.getId(), DEFAULT_FLO...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
setUp
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private KubernetesWatch kubernetesWatchWithMockListener() { Props azkProps = localProperties(); ApiClient localApiClient = WatchUtils.createApiClient(azkProps); return new KubernetesWatch(azkProps, localApiClient, new AzPodStausExtractingListener(), WatchUtils.createPodWatchParams(azkProps) ); ...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
kubernetesWatchWithMockListener
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private Props localProperties() { Props props = new Props(); props.put(ContainerizedDispatchManagerProperties.KUBERNETES_NAMESPACE, DEFAULT_NAMESPACE); props.put(ConfigurationKeys.AZKABAN_CLUSTER_NAME, DEFAULT_CLUSTER); props.put(ContainerizedDispatchManagerProperties.KUBERNETES_KUBE_CONFIG_PATH, ...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
localProperties
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private StatusLoggingListener statusLoggingListener() { return new StatusLoggingListener(); }
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
statusLoggingListener
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private ExecutorLoader mockedExecutorLoader() { return mock(ExecutorLoader.class); }
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
mockedExecutorLoader
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private ContainerizedImpl mockedContainerizedImpl() { return mock(ContainerizedImpl.class); }
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
mockedContainerizedImpl
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private ExecutableFlow createExecutableFlow(int executionId, azkaban.executor.Status flowStatus, String flowName, String projectName) throws Exception { ExecutableFlow flow = TestUtils.createTestExecutableFlow(projectName, flowName, DispatchMethod.CONTAINERIZED); flow.setExecutionId(ex...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
createExecutableFlow
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private ExecutableFlow createExecutableFlow(int executionId, azkaban.executor.Status flowStatus) throws Exception { return createExecutableFlow(executionId, flowStatus, DEFAULT_FLOW_FILE_NAME, DEFAULT_PROJECT_NAME); }
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
createExecutableFlow
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private FlowStatusManagerListener flowStatusUpdatingListener(Props azkProps) { return new FlowStatusManagerListener(azkProps, projectManager, mockedContainerizedImpl(), mockedExecutorLoader(), mock(AlerterHolder.class), containerizationMetrics, eventListener); }
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
flowStatusUpdatingListener
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private AzPodStatusDrivingListener statusDriverWithListener(AzPodStatusListener listener) { AzPodStatusDrivingListener azPodStatusDriver = new AzPodStatusDrivingListener(new Props()); azPodStatusDriver.registerAzPodStatusListener(listener); return azPodStatusDriver; }
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
statusDriverWithListener
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private Watch<V1Pod> fileBackedWatch(ApiClient apiClient) throws IOException { FileBackedWatch<V1Pod> fileBackedWatch = new FileBackedWatch<>( apiClient.getJSON(), new TypeToken<Response<V1Pod>>() {}.getType(), Paths.get(JSON_EVENTS_FILE_PATH)); return fileBackedWatch; }
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
fileBackedWatch
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private PreInitializedWatch defaultPreInitializedWatch(RawPodWatchEventListener driver, Watch<V1Pod> podWatch, int maxInitCount) throws IOException { return new PreInitializedWatch(this.defaultApiClient, driver, podWatch, new PodWatchParams(null, null, DEFAULT_WATCH_RESET_DELAY_M...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
defaultPreInitializedWatch
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Ignore("Flaky Test Blocking deployment, succeeds locally") @Test public void testWatchShutdownAndResetAfterFailure() throws Exception { AzPodStatusDrivingListener statusDriver = statusDriverWithListener(statusLoggingListener()); Watch<V1Pod> fileBackedWatch = fileBackedWatch(Config.defaultClient()); Pr...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
testWatchShutdownAndResetAfterFailure
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private void assertPodEventSequence(String podName, StatusLoggingListener loggingListener, List<AzPodStatus> transitionSequence) { // Record any information from the in-memory log of events. ConcurrentMap<String, Queue<AzPodStatus>> statusLogMap = loggingListener.getStatusLogMap(); StatusLogging...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
assertPodEventSequence
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Test public void testPodEventSequenceSuccess() throws Exception { StatusLoggingListener loggingListener = statusLoggingListener(); AzPodStatusDrivingListener statusDriver = statusDriverWithListener(loggingListener); Watch<V1Pod> fileBackedWatch = fileBackedWatch(Config.defaultClient()); PreInitialize...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
testPodEventSequenceSuccess
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Test public void testFlowStatusManagerListenerTransitionCompleted() throws Exception { // Setup a FlowUpdatingListener Props azkProps = new Props(); FlowStatusManagerListener updatingListener = flowStatusUpdatingListener(azkProps); // Add a StatusLoggingListener for sanity check the events sequence....
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
testFlowStatusManagerListenerTransitionCompleted
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Test public void testFlowManagerListenerInitContainerFailure() throws Exception { // Setup a FlowUpdatingListener Props azkProps = new Props(); FlowStatusManagerListener updatingListener = flowStatusUpdatingListener(azkProps); // Verify EXECUTION_STOPPED flow life cycle event is emitted assertExe...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
testFlowManagerListenerInitContainerFailure
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Test public void testFlowManagerListenerCreateContainerError() throws Exception { // Setup a FlowUpdatingListener Props azkProps = new Props(); FlowStatusManagerListener updatingListener = flowStatusUpdatingListener(azkProps); // Verify EXECUTION_STOPPED flow life cycle event is emitted assertExe...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
testFlowManagerListenerCreateContainerError
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Test public void testFlowManagerListenerOOMKilled() throws Exception { // Setup a FlowUpdatingListener Props azkProps = new Props(); FlowStatusManagerListener updatingListener = flowStatusUpdatingListener(azkProps); // Verify EXECUTION_STOPPED flow life cycle event is emitted assertExecutionStopp...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
testFlowManagerListenerOOMKilled
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Test public void testContainerStatusMetricsListener() throws Exception { // Setup a ContainerStatusMetricsHandlerListener Props azkProps = new Props(); AzPodStatusMetricsListener recordHandlerListener = new AzPodStatusMetricsListener(new DummyContainerizationMetricsImpl()); // Register Conta...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
testContainerStatusMetricsListener
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Test public void testFlowManagerListenerInvalidTransition() throws Exception { // Setup a FlowUpdatingListener Props azkProps = new Props(); FlowStatusManagerListener updatingListener = flowStatusUpdatingListener(azkProps); // Verify EXECUTION_STOPPED flow life cycle event is emitted assertExecut...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
testFlowManagerListenerInvalidTransition
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private void assertExecutionStoppedFlowEvent(final FlowStatusManagerListener updatingListener) { updatingListener.addListener((event) -> { Event flowEvent = (Event) event; if (flowEvent.getType().isFlowEventType()) { Assert.assertEquals(EventType.FLOW_FINISHED, flowEvent.getType()); Asse...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
assertExecutionStoppedFlowEvent
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private void assertFlowExecutionStopped(final ExecutableFlow flow) { final Queue<ExecutableNode> queue = new LinkedList<>(); queue.add(flow); // traverse through every node in flow1 while(!queue.isEmpty()) { ExecutableNode node = queue.poll(); if (node==flow) { assertThat(node.getSta...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
assertFlowExecutionStopped
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Test @Ignore("Blocking watch execution, useful only for development") public void testBlockingPodWatch() throws Exception { // Runs an unmodified instance of the watch that logs Raw watch events with debug verbosity. KubernetesWatch kubernetesWatch = kubernetesWatchWithMockListener(); kubernetesWatch.l...
These constants refer to kubernetes objects with the mock events file at {@code JSON_EVENTS_FILEP_PATH}.
testBlockingPodWatch
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override protected void initializePodWatch() { this.setPodWatch(this.preInitPodWatch); if (this.initWatchCount >= this.maxInitCount) { logger.debug("Requesting shutdowns as max init count was reached, init-count: " + this.initWatchCount); this.requestShutdown(); } this.initW...
An extension to {@link KubernetesWatch} which requires the underlying {@link Watch<V1Pod>} provider to be pre-initialized. This is the case for the {@link FileBackedWatch}, for example. This also disables watch initialization in the parent class and additionally maintains counters for how may times the watch initializa...
initializePodWatch
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override protected void startPodWatch() throws IOException { this.startWatchCount++; super.startPodWatch(); }
An extension to {@link KubernetesWatch} which requires the underlying {@link Watch<V1Pod>} provider to be pre-initialized. This is the case for the {@link FileBackedWatch}, for example. This also disables watch initialization in the parent class and additionally maintains counters for how may times the watch initializa...
startPodWatch
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public int getMaxInitCount() { return this.maxInitCount; }
An extension to {@link KubernetesWatch} which requires the underlying {@link Watch<V1Pod>} provider to be pre-initialized. This is the case for the {@link FileBackedWatch}, for example. This also disables watch initialization in the parent class and additionally maintains counters for how may times the watch initializa...
getMaxInitCount
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public int getInitWatchCount() { return this.initWatchCount; }
An extension to {@link KubernetesWatch} which requires the underlying {@link Watch<V1Pod>} provider to be pre-initialized. This is the case for the {@link FileBackedWatch}, for example. This also disables watch initialization in the parent class and additionally maintains counters for how may times the watch initializa...
getInitWatchCount
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public int getStartWatchCount() { return this.startWatchCount; }
An extension to {@link KubernetesWatch} which requires the underlying {@link Watch<V1Pod>} provider to be pre-initialized. This is the case for the {@link FileBackedWatch}, for example. This also disables watch initialization in the parent class and additionally maintains counters for how may times the watch initializa...
getStartWatchCount
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public Response<T> next() { try { String line = this.reader.readLine(); if (line == null) { throw new RuntimeException("Line is null"); } return parseLine(line); } catch (IOException e) { throw new RuntimeException("IO Exception during next met...
For providing watch events from a file, instead of the kubernetes API server. This serves 2 main purposes: (1) Extension of {@link Watch<T>} and can be used as a drop-in replacement within {@link KubernetesWatch} (2) Has the ability to parse JSON objects and convert them to {@link Watch<T>} events which are i...
next
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public boolean hasNext() { try { return this.reader.ready(); } catch (IOException e) { throw new RuntimeException("Exception in hasNext.", e); } }
For providing watch events from a file, instead of the kubernetes API server. This serves 2 main purposes: (1) Extension of {@link Watch<T>} and can be used as a drop-in replacement within {@link KubernetesWatch} (2) Has the ability to parse JSON objects and convert them to {@link Watch<T>} events which are i...
hasNext
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void close() throws IOException { if (this.reader != null) { this.reader.close(); } }
For providing watch events from a file, instead of the kubernetes API server. This serves 2 main purposes: (1) Extension of {@link Watch<T>} and can be used as a drop-in replacement within {@link KubernetesWatch} (2) Has the ability to parse JSON objects and convert them to {@link Watch<T>} events which are i...
close
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public static void logDebugStatusMap(ConcurrentMap<String, Queue<AzPodStatus>> statusLogMap) { requireNonNull(statusLogMap, "status log map must not be null"); statusLogMap.forEach((podname, queue) -> { StringBuilder sb = new StringBuilder(podname + ": "); queue.forEach(status -> sb.append(s...
Print the event log at debug verbosity. @param statusLogMap
logDebugStatusMap
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
private void logStatusForPod(AzPodStatusMetadata event) { requireNonNull(event, "event must not be null"); AzPodStatus podStatus = event.getAzPodStatus(); String podName = event.getPodName(); Queue<AzPodStatus> statusLog = this.statusLogMap.computeIfAbsent( podName, k -> new Concurrent...
Log status for the given event. @param event
logStatusForPod
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public ConcurrentMap<String, Queue<AzPodStatus>> getStatusLogMap() { return this.statusLogMap; }
Log status for the given event. @param event
getStatusLogMap
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onPodRequested(AzPodStatusMetadata event) { logStatusForPod(event); }
Log status for the given event. @param event
onPodRequested
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onPodScheduled(AzPodStatusMetadata event) { logStatusForPod(event); }
Log status for the given event. @param event
onPodScheduled
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onPodInitContainersRunning(AzPodStatusMetadata event) { logStatusForPod(event); }
Log status for the given event. @param event
onPodInitContainersRunning
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onPodAppContainersStarting(AzPodStatusMetadata event) { logStatusForPod(event); }
Log status for the given event. @param event
onPodAppContainersStarting
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onPodReady(AzPodStatusMetadata event) { logStatusForPod(event); }
Log status for the given event. @param event
onPodReady
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onPodCompleted(AzPodStatusMetadata event) { logStatusForPod(event); }
Log status for the given event. @param event
onPodCompleted
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onPodInitFailure(AzPodStatusMetadata event) { logStatusForPod(event); }
Log status for the given event. @param event
onPodInitFailure
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onPodAppFailure(AzPodStatusMetadata event) { logStatusForPod(event); }
Log status for the given event. @param event
onPodAppFailure
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onPodUnexpected(AzPodStatusMetadata event) { logStatusForPod(event); }
Log status for the given event. @param event
onPodUnexpected
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onEvent(Response<V1Pod> watchEvent) { logger.debug(String.format("%s : %s, %s, %s", watchEvent.type, watchEvent.object.getMetadata().getName(), watchEvent.object.getStatus().getMessage(), watchEvent.object.getStatus().getPhase())); AzPodStatus azPodStatus = AzPodStatusExt...
An implementation of {@link @RawPodWatchListener} that extracts the {@link AzPodStatus} for each pod watch event.
onEvent
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public synchronized void onPodRequested(final AzPodStatusMetadata event) { if (!event.getFlowPodMetadata().isPresent() || isUpdatedPodStatusDistinct(event)) { podRequestedCounter++; updatePodStatus(event); } }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
onPodRequested
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public synchronized void onPodScheduled(final AzPodStatusMetadata event) { if (!event.getFlowPodMetadata().isPresent() || isUpdatedPodStatusDistinct(event)) { podScheduledCounter++; updatePodStatus(event); } }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
onPodScheduled
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public synchronized void onPodInitContainersRunning(final AzPodStatusMetadata event) { if (!event.getFlowPodMetadata().isPresent() || isUpdatedPodStatusDistinct(event)) { podInitContainersRunningCounter++; updatePodStatus(event); } }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
onPodInitContainersRunning
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public synchronized void onPodAppContainersStarting(final AzPodStatusMetadata event) { if (!event.getFlowPodMetadata().isPresent() || isUpdatedPodStatusDistinct(event)) { PodAppContainersStartingCounter++; updatePodStatus(event); } }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
onPodAppContainersStarting
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public synchronized void onPodReady(final AzPodStatusMetadata event) { if (!event.getFlowPodMetadata().isPresent() || isUpdatedPodStatusDistinct(event)) { podReadyCounter++; updatePodStatus(event); } }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
onPodReady
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public synchronized void onPodCompleted(final AzPodStatusMetadata event) { if (!event.getFlowPodMetadata().isPresent() || isUpdatedPodStatusDistinct(event)) { podCompletedCounter++; updatePodStatus(event); } }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
onPodCompleted
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public synchronized void onPodInitFailure(final AzPodStatusMetadata event) { if (!event.getFlowPodMetadata().isPresent() || isUpdatedPodStatusDistinct(event)) { podInitFailureCounter++; updatePodStatus(event); } }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
onPodInitFailure
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public synchronized void onPodAppFailure(final AzPodStatusMetadata event) { if (!event.getFlowPodMetadata().isPresent() || isUpdatedPodStatusDistinct(event)) { podAppFailureCounter++; updatePodStatus(event); } }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
onPodAppFailure
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Override public void onPodUnexpected(AzPodStatusMetadata event) { super.onPodUnexpected(event); }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
onPodUnexpected
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public int getPodRequestedCounter() { return podRequestedCounter; }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
getPodRequestedCounter
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public int getPodInitContainersRunningCounter() { return podInitContainersRunningCounter; }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
getPodInitContainersRunningCounter
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public int getPodAppContainersStartingCounter() { return PodAppContainersStartingCounter; }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
getPodAppContainersStartingCounter
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public int getPodReadyCounter() { return podReadyCounter; }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
getPodReadyCounter
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public int getPodCompletedCounter() { return podCompletedCounter; }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
getPodCompletedCounter
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public int getPodInitFailureCounter() { return podInitFailureCounter; }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
getPodInitFailureCounter
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
public int getPodAppFailureCounter() { return podAppFailureCounter; }
A class extends {@link ContainerStatusMetricsListener} that can be tested for metrics updating
getPodAppFailureCounter
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/container/watch/KubernetesWatchTest.java
Apache-2.0
@Test public void testFetchVersionByImageTypesCase1() throws Exception { final String jsonInput = JSONUtils.readJsonFileAsString("image_management/image_type_rampups" + ".json"); final Map<String, List<ImageRampup>> imageTypeRampups = convertToRampupMap(jsonInput); final String jsonImageTypeNewAnd...
The test is for getting the specified image type version from the the active rampups. @throws Exception
testFetchVersionByImageTypesCase1
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
Apache-2.0
@Test public void testFetchVersionByImageTypesCase2() throws Exception { final String jsonImageTypeRampups = JSONUtils.readJsonFileAsString("image_management/" + "image_type_rampups.json"); final Map<String, List<ImageRampup>> imageTypeRampups = convertToRampupMap(jsonImageTypeRampups); final Set<...
This test is for getting the specified image types version from rampup as well as based on active image version. The image types for which active rampup is present get the version from rampups. For the remaining images it get the latest active version from image versions. @throws Exception
testFetchVersionByImageTypesCase2
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
Apache-2.0
@Test(expected = ImageMgmtException.class) public void testFetchVersionByImageTypesFailureCase() throws Exception { final String jsonImageTypeRampups = JSONUtils.readJsonFileAsString("image_management/" + "image_type_rampups.json"); final Map<String, List<ImageRampup>> imageTypeRampups = convertToRamp...
For the given image types some of the versions are from active rampups, some of the versions are based on active image version. But there are some image types for which there is neither active rampups nor active image version, hence throws exception. @throws Exception
testFetchVersionByImageTypesFailureCase
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
Apache-2.0
@Test public void testFetchAllImageTypesVersion() throws Exception { final String jsonImageTypeRampups = JSONUtils.readJsonFileAsString("image_management/" + "image_type_rampups.json"); final Map<String, List<ImageRampup>> imageTypeRampups = convertToRampupMap(jsonImageTypeRampups); final String j...
This test is a success test for getting version for all the available image types. The versions are from active image version. @throws Exception
testFetchAllImageTypesVersion
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
Apache-2.0
@Test(expected = ImageMgmtException.class) public void testFetchAllImageTypesVersionFailureCase() throws Exception { final String jsonImageTypeRampups = JSONUtils.readJsonFileAsString("image_management/" + "image_type_rampups.json"); final Map<String, List<ImageRampup>> imageTypeRampups = convertToRam...
This test is a failure test for getting version for all the available image types. For some of the image types there is neighter active image rampups nor active image versions. Hence the test throws exception. @throws Exception
testFetchAllImageTypesVersionFailureCase
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
Apache-2.0
@Test public void testFetchVersionByImageTypesWithRampRule() throws Exception { final String jsonInput = JSONUtils.readJsonFileAsString("image_management/image_type_rampups2.json"); final Map<String, List<ImageRampup>> imageTypeRampups = convertToRampupMap(jsonInput); final Set<String> imageTypes = new Tr...
This test is a failure test for getting version for all the available image types. For some of the image types there is neighter active image rampups nor active image versions. Hence the test throws exception. @throws Exception
testFetchVersionByImageTypesWithRampRule
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
Apache-2.0
private Map<String, List<ImageRampup>> convertToRampupMap(final String input) { Map<String, List<ImageRampup>> imageTypeRampups = null; try { imageTypeRampups = this.objectMapper.readValue(input, new TypeReference<Map<String, List<ImageRampup>>>() { }); } catch (final...
This test is a failure test for getting version for all the available image types. For some of the image types there is neighter active image rampups nor active image versions. Hence the test throws exception. @throws Exception
convertToRampupMap
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/imagemgmt/rampup/ImageRampupManagerImplTest.java
Apache-2.0
@Test public void test() throws IOException { VersionSetLoader loaderSpy = Mockito.spy(this.loader); String testJsonString1 = "{\"key1\":{\"version\":\"value1\",\"path\":\"path1\"," + "\"state\":\"ACTIVE\"},\"key2\":{\"version\":\"value2\",\"path\":\"path2\"," + "\"state\":\"ACTIVE\"},\"key3\...
This test executes various methods and verify various cases.
test
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/imagemgmt/version/JdbcVersionSetLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/imagemgmt/version/JdbcVersionSetLoaderTest.java
Apache-2.0
@Test public void testGetResource() throws IOException { final URL testJar = makeTestJar().toURI().toURL(); final ClassLoader currentClassLoader = getClass().getClassLoader(); final ClassLoader jobClassLoader = new JobClassLoader( new URL[]{testJar}, currentClassLoader, "testJob"); Assert.as...
Test the case where a resource file exists in the Job's classloader.
testGetResource
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
Apache-2.0
private File makeTestJar() throws IOException { final File jarFile = this.testDir.newFile("test.jar"); try (final JarOutputStream out = new JarOutputStream(new FileOutputStream(jarFile))) { final ZipEntry entry = new ZipEntry(RESOURCE_FILE); out.putNextEntry(entry); out.write("hello".getBytes(...
Test the case where a resource file exists in the Job's classloader.
makeTestJar
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
Apache-2.0
@Test(expected = ClassNotFoundException.class) public void testNonexistClass() throws ClassNotFoundException { final ClassLoader currentClassLoader = getClass().getClassLoader(); final ClassLoader jobClassLoader = new JobClassLoader( new URL[]{}, currentClassLoader, "testJob"); Assert.assertNull(...
Test the case where the define job class does not exist.
testNonexistClass
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
Apache-2.0
@Test public void testClassAvailableInParentClassLoader() throws ClassNotFoundException { final ClassLoader currentClassLoader = getClass().getClassLoader(); final ClassLoader jobClassLoader = new JobClassLoader( new URL[]{}, currentClassLoader, "testJob"); final Class clazz = jobClassLoader.loadC...
Test class loading of a class that is available only in the parent classloader.
testClassAvailableInParentClassLoader
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
Apache-2.0
@Test public void testClassAvailableInJobClassLoader() throws MalformedURLException, ClassNotFoundException { final ClassLoader currentClassLoader = getClass().getClassLoader(); final File helloworldJar = new File(currentClassLoader.getResource(SAMPLE_JAR).getFile()); final URL helloworlURL = hello...
Test class loading of a class that is available only in the JobClassloader. The class is provided in 'helloworld.jar'.
testClassAvailableInJobClassLoader
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
Apache-2.0
@Test public void testPropsClass() throws ClassNotFoundException { ClassLoader currentClassLoader = getClass().getClassLoader(); JobClassLoader jobClassLoader = new JobClassLoader( new URL[] {}, currentClassLoader, "testJob"); // make azkaban.utils.Props class available to the JobClassLoader j...
Check {@link azkaban.utils.Props} is already loaded by its parent classloader.
testPropsClass
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/JobClassLoaderTest.java
Apache-2.0
@Test public void testOneUnixCommandWithProxyUserInsteadOfSubmitUser() throws Exception { // Initialize the Props this.props.removeLocal(CommonJobProperties.SUBMIT_USER); this.props.put(JobProperties.USER_TO_PROXY, "test_user"); this.props.put(ProcessJob.COMMAND, "ls -al"); this.job.run(); }
this job should run fine if the props contain user.to.proxy
testOneUnixCommandWithProxyUserInsteadOfSubmitUser
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
Apache-2.0
@Test(expected = RuntimeException.class) public void testOneUnixCommandWithRootUser() throws Exception { // Initialize the Props this.props.removeLocal(CommonJobProperties.SUBMIT_USER); this.props.put(JobProperties.USER_TO_PROXY, "root"); this.props.put("execute.as.user", "true"); this.props.put(...
this job should fail because it sets user.to.proxy = root which is black listed
testOneUnixCommandWithRootUser
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
Apache-2.0
@Test(expected = RuntimeException.class) public void testOneUnixCommandWithAzkabanUser() throws Exception { // Initialize the Props this.props.removeLocal(CommonJobProperties.SUBMIT_USER); this.props.put(JobProperties.USER_TO_PROXY, "azkaban"); this.props.put("execute.as.user", "true"); this.prop...
this job should fail because it sets user.to.proxy = azkaban which is black listed
testOneUnixCommandWithAzkabanUser
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
Apache-2.0
@Test public void testFailedUnixCommand() throws Exception { // Initialize the Props this.props.put(ProcessJob.COMMAND, "xls -al"); try { this.job.run(); } catch (final RuntimeException e) { Assert.assertTrue(true); e.printStackTrace(); } }
this job should fail because it sets user.to.proxy = azkaban which is black listed
testFailedUnixCommand
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
Apache-2.0
@Test public void testMultipleUnixCommands() throws Exception { // Initialize the Props this.props.put(ProcessJob.COMMAND, "pwd"); this.props.put("command.1", "date"); this.props.put("command.2", "whoami"); this.job.run(); }
this job should fail because it sets user.to.proxy = azkaban which is black listed
testMultipleUnixCommands
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
Apache-2.0
@Test public void testPartitionCommand() throws Exception { final String test1 = "a b c"; Assert.assertArrayEquals(new String[]{"a", "b", "c"}, ProcessJob.partitionCommandLine(test1)); final String test2 = "a 'b c'"; Assert.assertArrayEquals(new String[]{"a", "b c"}, ProcessJob.parti...
this job should fail because it sets user.to.proxy = azkaban which is black listed
testPartitionCommand
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
Apache-2.0
@Test public void testCancelDuringPreparation() throws InterruptedException, ExecutionException { final Props jobProps = new Props(); jobProps.put("command", "echo hello"); jobProps.put("working.dir", "/tmp"); jobProps.put(JobProperties.USER_TO_PROXY, "test"); jobProps.put("azkaban.flow.projectnam...
test cancellation of the job before associated process is constructed expect job will be cancelled successfully
testCancelDuringPreparation
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
Apache-2.0
@Test public void testCancelAfterJobProcessCreation() throws InterruptedException, ExecutionException { this.props.put(ProcessJob.COMMAND, "sleep 5"); final ExecutorService executorService = Executors.newSingleThreadExecutor(); final Future future = executorService.submit(() -> { try { this...
test cancellation of the job before associated process is constructed expect job will be cancelled successfully
testCancelAfterJobProcessCreation
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
Apache-2.0
@Override public void run() { try { info("sleep for some time before actually running the job"); Thread.sleep(10); super.run(); } catch (final Exception ex) { this.getLog().error(ex); } }
test cancellation of the job before associated process is constructed expect job will be cancelled successfully
run
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobExecutor/ProcessJobTest.java
Apache-2.0
@Before public void setUp() throws Exception { // TODO: reallocf Remove initServiceProvider when ProcessJob fully guiced initServiceProvider(); final File jobTypeDir = this.temp.newFolder(TEST_PLUGIN_DIR); this.testPluginDirPath = jobTypeDir.getCanonicalPath(); final URL resourceUrl = Resources....
Test the flow run, especially with embedded flows. Files are in unit/plugins/jobtypes
setUp
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerTest.java
Apache-2.0
@After public void tearDown() throws IOException { this.temp.delete(); }
Test the flow run, especially with embedded flows. Files are in unit/plugins/jobtypes
tearDown
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerTest.java
Apache-2.0
@Test public void testCommonPluginProps() throws Exception { final JobTypePluginSet pluginSet = this.manager.getJobTypePluginSet(); final Props props = pluginSet.getCommonPluginJobProps(); System.out.println(props.toString()); assertEquals("commonprop1", props.getString("commonprop1")); assertEqu...
Tests that the common and common private properties are loaded correctly
testCommonPluginProps
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerTest.java
Apache-2.0
@Test public void testLoadedClasses() throws Exception { final JobTypePluginSet pluginSet = this.manager.getJobTypePluginSet(); final Props props = pluginSet.getCommonPluginJobProps(); System.out.println(props.toString()); assertEquals("commonprop1", props.getString("commonprop1")); assertEquals(...
Tests that the proper classes were loaded and that the common and the load properties are properly loaded.
testLoadedClasses
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerTest.java
Apache-2.0
@Test public void testJobPropsProcessor() throws Exception { final Props jobProps = new Props(); jobProps.put("type", "testjobwithpropsprocessor"); final Job job = this.manager.buildJobExecutor("testjobwithpropsprocessor", jobProps, this.logger); assertTrue(job instanceof FakeJavaJob); final Fake...
Configure a {@link JobPropsProcessor} for a jobtype plugin and verify the JobPropsProcessor are invoked correctly for jobs of that type.
testJobPropsProcessor
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerTest.java
Apache-2.0
private Cluster createDefaultCluster() throws IOException { final Props clusterProps = new Props(); final File hadoopJar = makeTestJar("hadoop", "hadoop.jar"); clusterProps.put(Cluster.LIBRARY_PATH_PREFIX + "hadoop", hadoopJar.getParentFile().getPath()); clusterProps.put(Cluster.NATIVE_LIBRARY_PATH_PREF...
Unit tests for {@link JobTypeManager} when clusters are configured.
createDefaultCluster
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
private File makeTestJar(final String folderName, final String jarName) throws IOException { final File folder = new File(this.testDirectory, folderName); folder.mkdirs(); final File jarFile = new File(folder, jarName); try (final JarOutputStream out = new JarOutputStream(new FileOutputStream(jarF...
Unit tests for {@link JobTypeManager} when clusters are configured.
makeTestJar
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
@Before public void setUp() throws Exception { initServiceProvider(); }
Unit tests for {@link JobTypeManager} when clusters are configured.
setUp
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
@Test public void testJobTypeManagerJobSetupWithoutJobComponentDependency() { final JobTypeManager manager = new JobTypeManager(this.testPluginDirPath, null, this.getClass().getClassLoader(), this.clusterRouter, null); Props jobProps = new Props(); jobProps.put("type", "anothertestjob"); jobP...
Unit test of JobTypeManager's setup for jobs without 'job.dependency.components' specified.
testJobTypeManagerJobSetupWithoutJobComponentDependency
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0