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 mockExecution(final int encodingType, final byte[] flowData) throws SQLException {
when(this.rs.next()).thenReturn(true).thenReturn(false);
// execution id
when(this.rs.getInt("exec_id")).thenReturn(1);
// encodingType
when(this.rs.getInt("enc_type")).thenReturn(encodingType);
// data
when(this.rs.getBytes("flow_data")).thenReturn(flowData);
// executor host
when(this.rs.getString("host")).thenReturn(null);
// executor port
when(this.rs.getInt("port")).thenReturn(0);
// executorId
when(this.rs.getInt("executorId")).thenReturn(1);
// executorStatus
when(this.rs.getBoolean("executorStatus")).thenReturn(false);
}
|
Also @see ExecutionFlowDaoTest - DB operations of FetchActiveFlowDao are tested there.
|
mockExecution
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/FetchActiveFlowDaoTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/FetchActiveFlowDaoTest.java
|
Apache-2.0
|
@Test
public void getKeyStoreNull() {
final KeyStore keyStore = keyStoreManager.getKeyStore();
Assert.assertNull(keyStore);
}
|
Since the KeyStore is not set, it must be null
|
getKeyStoreNull
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/KeyStoreManagerTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/KeyStoreManagerTest.java
|
Apache-2.0
|
@Test
public void getKeyStoreNotNull() {
this.keyStore = Mockito.mock(KeyStore.class);
keyStoreManager.setKeyStore(this.keyStore);
final KeyStore keyStore1 = keyStoreManager.getKeyStore();
Assert.assertNotNull(keyStore1);
Assert.assertEquals(this.keyStore, keyStore1);
}
|
KeyStore is set, it must not be null, and must be same as input when retrieved.
|
getKeyStoreNotNull
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/KeyStoreManagerTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/KeyStoreManagerTest.java
|
Apache-2.0
|
@Override
public void uploadExecutableFlow(final ExecutableFlow flow) throws ExecutorManagerException {
// Clone the flow node to mimick how it would be saved in DB.
// If we would keep a handle to the original flow node, we would also see any changes made after
// this method was called. We must only store a snapshot of the current state.
// Also to avoid modifying statuses of the original job nodes in this.updateExecutableFlow()
final ExecutableFlow exFlow = ExecutableFlow.createExecutableFlow(flow.toObject(),
flow.getStatus());
this.flows.put(flow.getExecutionId(), exFlow);
this.flowUpdateCount++;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
uploadExecutableFlow
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public ExecutableFlow fetchExecutableFlow(final int execId) throws ExecutorManagerException {
final ExecutableFlow flow = this.flows.get(execId);
return ExecutableFlow.createExecutableFlow(flow.toObject(), flow.getStatus());
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutableFlow
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Map<Integer, Pair<ExecutionReference, ExecutableFlow>> fetchActiveFlows(
final DispatchMethod dispatchMethod) throws ExecutorManagerException {
return this.activeFlows;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchActiveFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Map<Integer, Pair<ExecutionReference, ExecutableFlow>> fetchUnfinishedFlows()
throws ExecutorManagerException {
return this.activeFlows;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchUnfinishedFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Pair<ExecutionReference, ExecutableFlow> fetchUnfinishedFlow(final int executionId)
throws ExecutorManagerException {
return this.activeFlows.get(executionId);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchUnfinishedFlow
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<Integer> selectUnfinishedFlows(final int projectId, final String flowId) throws ExecutorManagerException {
return this.activeFlows.entrySet().stream()
.filter(entry -> entry.getValue().getSecond().getProjectId() == projectId && entry.getValue().getSecond().getFlowId().equals(flowId))
.map(entry -> entry.getValue().getSecond().getExecutionId())
.collect(Collectors.toList());
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
selectUnfinishedFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<Integer> selectUnfinishedFlows() throws ExecutorManagerException {
return this.activeFlows.entrySet().stream()
.map(entry -> entry.getValue().getSecond().getExecutionId())
.collect(Collectors.toList());
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
selectUnfinishedFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Map<Integer, Pair<ExecutionReference, ExecutableFlow>> fetchUnfinishedFlowsMetadata()
throws ExecutorManagerException {
return this.activeFlows.entrySet().stream()
.collect(Collectors.toMap(Entry::getKey, e -> {
final ExecutableFlow metadata = getExecutableFlowMetadata(e.getValue().getSecond());
return new Pair<>(e.getValue().getFirst(), metadata);
}));
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchUnfinishedFlowsMetadata
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
private ExecutableFlow getExecutableFlowMetadata(
final ExecutableFlow fullExFlow) {
final Flow flow = new Flow(fullExFlow.getId());
final Project project = new Project(fullExFlow.getProjectId(), null);
project.setVersion(fullExFlow.getVersion());
flow.setVersion(fullExFlow.getVersion());
final ExecutableFlow metadata = new ExecutableFlow(project, flow);
metadata.setExecutionId(fullExFlow.getExecutionId());
metadata.setStatus(fullExFlow.getStatus());
metadata.setSubmitTime(fullExFlow.getSubmitTime());
metadata.setStartTime(fullExFlow.getStartTime());
metadata.setEndTime(fullExFlow.getEndTime());
metadata.setSubmitUser(fullExFlow.getSubmitUser());
return metadata;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
getExecutableFlowMetadata
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Pair<ExecutionReference, ExecutableFlow> fetchActiveFlowByExecId(final int execId) {
return new Pair<>(null, null);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchActiveFlowByExecId
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutableFlow> fetchFlowHistory(final int projectId, final String flowId,
final int skip, final int num) throws ExecutorManagerException {
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchFlowHistory
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void addActiveExecutableReference(final ExecutionReference ref)
throws ExecutorManagerException {
this.refs.put(ref.getExecId(), ref);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
addActiveExecutableReference
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void removeActiveExecutableReference(final int execId)
throws ExecutorManagerException {
this.refs.remove(execId);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
removeActiveExecutableReference
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void updateExecutableFlow(final ExecutableFlow flow)
throws ExecutorManagerException {
final ExecutableFlow toUpdate = this.flows.get(flow.getExecutionId());
toUpdate.applyUpdateObject(flow.toUpdateObject(0));
this.flowUpdateCount++;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
updateExecutableFlow
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void uploadExecutableNode(final ExecutableNode node, final Props inputParams)
throws ExecutorManagerException {
// Clone the job node to mimick how it would be saved in DB.
// If we would keep a handle to the original job node, we would also see any changes made after
// this method was called. We must only store a snapshot of the current state.
// Also to avoid modifying statuses of the original job nodes in this.updateExecutableNode()
final ExecutableNode exNode = new ExecutableNode();
exNode.fillExecutableFromMapObject(node.toObject());
this.nodes.put(node.getId(), exNode);
this.jobUpdateCount.put(node.getId(), 1);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
uploadExecutableNode
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void updateExecutableNode(final ExecutableNode node)
throws ExecutorManagerException {
final ExecutableNode foundNode = this.nodes.get(node.getId());
if (foundNode == null) {
return;
}
foundNode.setEndTime(node.getEndTime());
foundNode.setStartTime(node.getStartTime());
foundNode.setStatus(node.getStatus());
foundNode.setUpdateTime(node.getUpdateTime());
Integer value = this.jobUpdateCount.get(node.getId());
if (value == null) {
throw new ExecutorManagerException("The node has not been uploaded");
} else {
this.jobUpdateCount.put(node.getId(), ++value);
}
this.flowUpdateCount++;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
updateExecutableNode
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public int fetchNumExecutableFlows(final int projectId, final String flowId)
throws ExecutorManagerException {
return 0;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchNumExecutableFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public int fetchNumExecutableFlows() throws ExecutorManagerException {
// TODO Auto-generated method stub
return 0;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchNumExecutableFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
public Integer getNodeUpdateCount(final String jobId) {
return this.jobUpdateCount.get(jobId);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
getNodeUpdateCount
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public ExecutableJobInfo fetchJobInfo(final int execId, final String jobId, final int attempt)
throws ExecutorManagerException {
// TODO Auto-generated method stub
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchJobInfo
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public boolean updateExecutableReference(final int execId, final long updateTime)
throws ExecutorManagerException {
// TODO Auto-generated method stub
return true;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
updateExecutableReference
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutableFlow> fetchFlowHistory(final int skip, final int num)
throws ExecutorManagerException {
// TODO Auto-generated method stub
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchFlowHistory
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutableFlow> fetchFlowHistory(final String projectContains,
final String flowContains, final String userNameContains, final int status,
final long startData,
final long endData, final int skip, final int num) throws ExecutorManagerException {
// TODO Auto-generated method stub
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchFlowHistory
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutableFlow> fetchFlowHistory(final int projectId, final String flowId,
final long startTime) throws ExecutorManagerException {
return new ArrayList<>();
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchFlowHistory
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutableJobInfo> fetchJobHistory(final int projectId, final String jobId,
final int skip, final int size) throws ExecutorManagerException {
// TODO Auto-generated method stub
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchJobHistory
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public int fetchNumExecutableNodes(final int projectId, final String jobId)
throws ExecutorManagerException {
// TODO Auto-generated method stub
return 0;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchNumExecutableNodes
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Props fetchExecutionJobInputProps(final int execId, final String jobId)
throws ExecutorManagerException {
// TODO Auto-generated method stub
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutionJobInputProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Props fetchExecutionJobOutputProps(final int execId, final String jobId)
throws ExecutorManagerException {
// TODO Auto-generated method stub
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutionJobOutputProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Pair<Props, Props> fetchExecutionJobProps(final int execId, final String jobId)
throws ExecutorManagerException {
// TODO Auto-generated method stub
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutionJobProps
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutableJobInfo> fetchJobInfoAttempts(final int execId, final String jobId)
throws ExecutorManagerException {
// TODO Auto-generated method stub
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchJobInfoAttempts
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutableFlow> fetchFlowHistory(final int projectId, final String flowId,
final int skip, final int num, final Status status) throws ExecutorManagerException {
// TODO Auto-generated method stub
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchFlowHistory
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<Object> fetchAttachments(final int execId, final String name, final int attempt)
throws ExecutorManagerException {
// TODO Auto-generated method stub
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchAttachments
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void uploadAttachmentFile(final ExecutableNode node, final File file)
throws ExecutorManagerException {
// TODO Auto-generated method stub
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
uploadAttachmentFile
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<Executor> fetchActiveExecutors() throws ExecutorManagerException {
final List<Executor> activeExecutors = new ArrayList<>();
for (final Executor executor : this.executors) {
if (executor.isActive()) {
activeExecutors.add(executor);
}
}
return activeExecutors;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchActiveExecutors
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Executor fetchExecutor(final String host, final int port)
throws ExecutorManagerException {
for (final Executor executor : this.executors) {
if (executor.getHost().equals(host) && executor.getPort() == port) {
return executor;
}
}
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutor
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Executor fetchExecutor(final int executorId) throws ExecutorManagerException {
for (final Executor executor : this.executors) {
if (executor.getId() == executorId) {
return executor;
}
}
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutor
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Executor addExecutor(final String host, final int port)
throws ExecutorManagerException {
Executor executor = null;
if (fetchExecutor(host, port) == null) {
this.executorIdCounter++;
executor = new Executor(this.executorIdCounter, host, port, true);
this.executors.add(executor);
}
return executor;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
addExecutor
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void removeExecutor(final String host, final int port) throws ExecutorManagerException {
final Executor executor = fetchExecutor(host, port);
if (executor != null) {
this.executorIdCounter--;
this.executors.remove(executor);
}
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
removeExecutor
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void postExecutorEvent(final Executor executor, final EventType type, final String user,
final String message) throws ExecutorManagerException {
final ExecutorLogEvent event =
new ExecutorLogEvent(executor.getId(), user, new Date(), type, message);
if (!this.executorEvents.containsKey(executor.getId())) {
this.executorEvents.put(executor.getId(), new ArrayList<>());
}
this.executorEvents.get(executor.getId()).add(event);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
postExecutorEvent
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutorLogEvent> getExecutorEvents(final Executor executor, final int num,
final int skip) throws ExecutorManagerException {
if (!this.executorEvents.containsKey(executor.getId())) {
final List<ExecutorLogEvent> events = this.executorEvents.get(executor.getId());
return events.subList(skip, Math.min(num + skip - 1, events.size() - 1));
}
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
getExecutorEvents
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void updateExecutor(final Executor executor) throws ExecutorManagerException {
final Executor oldExecutor = fetchExecutor(executor.getId());
this.executors.remove(oldExecutor);
this.executors.add(executor);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
updateExecutor
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<Executor> fetchAllExecutors() throws ExecutorManagerException {
return this.executors;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchAllExecutors
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void assignExecutor(final int executorId, final int execId)
throws ExecutorManagerException {
final ExecutionReference ref = this.refs.get(execId);
ref.setExecutor(fetchExecutor(executorId));
this.executionExecutorMapping.put(execId, executorId);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
assignExecutor
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Executor fetchExecutorByExecutionId(final int execId) throws ExecutorManagerException {
if (this.executionExecutorMapping.containsKey(execId)) {
return fetchExecutor(this.executionExecutorMapping.get(execId));
} else {
throw new ExecutorManagerException(
"Failed to find executor with execution : " + execId);
}
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutorByExecutionId
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<Pair<ExecutionReference, ExecutableFlow>> fetchQueuedFlows()
throws ExecutorManagerException {
return fetchQueuedFlows(Status.PREPARING);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchQueuedFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
public List<Pair<ExecutionReference, ExecutableFlow>> fetchQueuedFlows(Status status)
throws ExecutorManagerException {
final List<Pair<ExecutionReference, ExecutableFlow>> queuedFlows =
new ArrayList<>();
for (final int execId : this.refs.keySet()) {
if (!this.executionExecutorMapping.containsKey(execId)) {
queuedFlows.add(new Pair<>(this.refs
.get(execId), this.flows.get(execId)));
}
}
return queuedFlows;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchQueuedFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<Integer> selectQueuedFlows(Status status)
throws ExecutorManagerException {
return this.fetchQueuedFlows(status).stream().map(f -> f.getSecond().getExecutionId()).collect(
Collectors.toList());
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
selectQueuedFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutableFlow> fetchStaleFlowsForStatus(final Status status,
final ImmutableMap<Status, Pair<Duration, String>> validityMap)
throws ExecutorManagerException {
throw new ExecutorManagerException("Method Not Implemented!");
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchStaleFlowsForStatus
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutableFlow> fetchFreshFlowsForStatus(final Status status,
final ImmutableMap<Status, Pair<Duration, String>> validityMap)
throws ExecutorManagerException{
throw new ExecutorManagerException("Method Not Implemented!");
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchFreshFlowsForStatus
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
// TODO(anish-mal) To be used in a future unit test, once System calls to obtain
// current time have been replaced by Clocks. Clocks are needed in order to write
// unit tests for duration based features. Without it, the tests end up being flaky.
public List<Integer> selectAgedQueuedFlows(final Duration minAge)
throws ExecutorManagerException {
final List<Integer> agedQueuedFlowIds = new ArrayList<>();
long timeThreshoold = System.currentTimeMillis() - minAge.toMillis();
for (final int execId : this.refs.keySet()) {
if (!this.executionExecutorMapping.containsKey(execId)) {
ExecutableFlow agedFlow = this.flows.get(execId);
if (agedFlow.getSubmitTime() < timeThreshoold) {
agedQueuedFlowIds.add(execId);
}
}
}
return agedQueuedFlowIds;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
selectAgedQueuedFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void unassignExecutor(final int executionId) throws ExecutorManagerException {
this.executionExecutorMapping.remove(executionId);
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
unassignExecutor
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public List<ExecutableFlow> fetchRecentlyFinishedFlows(final Duration maxAge)
throws ExecutorManagerException {
return new ArrayList<>();
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchRecentlyFinishedFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public int selectAndUpdateExecution(final int executorId, final boolean isActive,
final DispatchMethod dispatchMethod)
throws ExecutorManagerException {
return 1;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
selectAndUpdateExecution
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public int selectAndUpdateExecutionWithLocking(final int executorId, final boolean isActive,
final DispatchMethod dispatchMethod)
throws ExecutorManagerException {
return 1;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
selectAndUpdateExecutionWithLocking
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Set<Integer> selectAndUpdateExecutionWithLocking(final boolean batchEnabled,
final int limit,
final Status updatedStatus,
final DispatchMethod dispatchMethod) throws ExecutorManagerException {
final Set<Integer> executions = new HashSet<>();
executions.add(1);
return executions;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
selectAndUpdateExecutionWithLocking
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public ExecutableRampMap fetchExecutableRampMap() throws ExecutorManagerException {
ExecutableRampMap map = ExecutableRampMap.createInstance();
map.add("rampId",
ExecutableRamp.builder("dali", "RampPolicy")
.setMetadata(ExecutableRamp.Metadata.builder()
.setMaxFailureToPause(5)
.setMaxFailureToRampDown(10)
.setPercentageScaleForMaxFailure(false)
.build())
.setState(ExecutableRamp.State.builder()
.setStartTime(0)
.setEndTime(0)
.setLastUpdatedTime(0)
.setNumOfTrail(0)
.setNumOfSuccess(0)
.setNumOfFailure(0)
.setNumOfIgnored(0)
.setPaused(false)
.setRampStage(0)
.setActive(true)
.build())
.build()
);
return map;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutableRampMap
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public ExecutableRampItemsMap fetchExecutableRampItemsMap() throws ExecutorManagerException {
ExecutableRampItemsMap map = ExecutableRampItemsMap.createInstance();
map.add("rampId", "dependencyId", "defaultValue");
return map;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutableRampItemsMap
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public ExecutableRampDependencyMap fetchExecutableRampDependencyMap() throws ExecutorManagerException {
ExecutableRampDependencyMap map = ExecutableRampDependencyMap.createInstance();
map.add("dependency", "defaultValue", "pig,hive,spark");
return map;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutableRampDependencyMap
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public ExecutableRampExceptionalFlowItemsMap fetchExecutableRampExceptionalFlowItemsMap() throws ExecutorManagerException {
ExecutableRampExceptionalFlowItemsMap map = ExecutableRampExceptionalFlowItemsMap.createInstance();
map.add("rampId", "flowId", ExecutableRampStatus.SELECTED, 15500000L);
return map;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutableRampExceptionalFlowItemsMap
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public ExecutableRampExceptionalJobItemsMap fetchExecutableRampExceptionalJobItemsMap() throws ExecutorManagerException {
ExecutableRampExceptionalJobItemsMap map = ExecutableRampExceptionalJobItemsMap.createInstance();
map.add("rampId", "flowId", "jobId", ExecutableRampStatus.UNSELECTED, 15000000L);
return map;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
fetchExecutableRampExceptionalJobItemsMap
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void updateExecutedRampFlows(final String ramp, ExecutableRampExceptionalItems executableRampExceptionalItems)
throws ExecutorManagerException {
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
updateExecutedRampFlows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void updateExecutableRamp(ExecutableRamp executableRamp) throws ExecutorManagerException {
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
updateExecutableRamp
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public int updateVersionSetId(int executionId, int versionSetId) throws ExecutorManagerException {
return 0;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
updateVersionSetId
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public Map<String, String> doRampActions(List<Map<String, Object>> rampActionsMap) throws ExecutorManagerException {
return null;
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
doRampActions
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Override
public void unsetExecutorIdForExecution(final int executionId) {
}
|
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutorLoader).
Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
|
unsetExecutorIdForExecution
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/MockExecutorLoader.java
|
Apache-2.0
|
@Test
public void updateExecutionsUpdateCallFailsExecutorDoesntExist() throws Exception {
mockUpdateCallFails();
when(this.executorLoader.fetchExecutor(anyInt())).thenReturn(null);
DateTimeUtils.setCurrentMillisFixed(System.currentTimeMillis());
this.updater.updateExecutions();
verify(this.executionFinalizer).finalizeFlow(
this.execution, "Not running on the assigned executor (any more)", null);
}
|
Should finalize execution if executor doesn't exist in the DB.
|
updateExecutionsUpdateCallFailsExecutorDoesntExist
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
Apache-2.0
|
@Test
public void updateExecutionsUpdateCallFailsExecutorCheckThrows() throws Exception {
mockUpdateCallFails();
when(this.executorLoader.fetchExecutor(anyInt()))
.thenThrow(new ExecutorManagerException("Mocked fetchExecutor failure"));
DateTimeUtils.setCurrentMillisFixed(System.currentTimeMillis());
this.updater.updateExecutions();
verifyZeroInteractions(this.executionFinalizer);
}
|
Shouldn't finalize executions if executor's existence can't be checked.
|
updateExecutionsUpdateCallFailsExecutorCheckThrows
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
Apache-2.0
|
private void mockFlowSucceeded() throws Exception {
final Map<String, Object> executionMap = mockUpdateResponse();
executionMap.put(ExecutableNode.STATUS_PARAM, Status.SUCCEEDED.getNumVal());
}
|
Shouldn't finalize executions if executor's existence can't be checked.
|
mockFlowSucceeded
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
Apache-2.0
|
private void mockExecutorDoesNotExist() {
this.runningExecutions.get().put(EXECUTION_ID_77, new Pair<>(
new ExecutionReference(EXECUTION_ID_77, null, DispatchMethod.PUSH), this.execution));
}
|
Shouldn't finalize executions if executor's existence can't be checked.
|
mockExecutorDoesNotExist
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
Apache-2.0
|
private void mockUpdateCallFails() throws ExecutorManagerException {
doThrow(API_CALL_EXCEPTION).when(this.apiGateway).updateExecutions(any(), any());
}
|
Shouldn't finalize executions if executor's existence can't be checked.
|
mockUpdateCallFails
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
Apache-2.0
|
private void verifyCallUpdateApi() throws ExecutorManagerException {
verify(this.apiGateway).updateExecutions(
this.activeExecutor, Collections.singletonList(this.execution));
}
|
Shouldn't finalize executions if executor's existence can't be checked.
|
verifyCallUpdateApi
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
Apache-2.0
|
private void mockFlowDoesNotExist() throws Exception {
final Map<String, Object> executionMap = mockUpdateResponse();
executionMap.put(ConnectorParams.RESPONSE_ERROR, "Flow does not exist");
}
|
Shouldn't finalize executions if executor's existence can't be checked.
|
mockFlowDoesNotExist
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
Apache-2.0
|
private Map<String, Object> mockUpdateResponse() throws Exception {
final Map<String, Object> executionMap = new HashMap<>(ImmutableMap.of(
ConnectorParams.UPDATE_MAP_EXEC_ID, EXECUTION_ID_77));
mockUpdateResponse(ImmutableMap.of(
ConnectorParams.RESPONSE_UPDATED_FLOWS, Collections.singletonList(executionMap)));
return executionMap;
}
|
Shouldn't finalize executions if executor's existence can't be checked.
|
mockUpdateResponse
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
Apache-2.0
|
@SuppressWarnings("unchecked")
private void mockUpdateResponse(
final Map<String, List<Map<String, Object>>> map) throws Exception {
doReturn(map).when(this.apiGateway).updateExecutions(any(), any());
}
|
Shouldn't finalize executions if executor's existence can't be checked.
|
mockUpdateResponse
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
Apache-2.0
|
private void verifyFinalizeFlow() {
verify(this.executionFinalizer).finalizeFlow(this.execution,
"Not running on the assigned executor (any more)", null);
}
|
Shouldn't finalize executions if executor's existence can't be checked.
|
verifyFinalizeFlow
|
java
|
azkaban/azkaban
|
azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/RunningExecutionsUpdaterTest.java
|
Apache-2.0
|
@BeforeClass
public static void setUp() throws Exception {
dbOperator = Utils.initTestDB();
setupImageTables();
}
|
This class covers unit tests for KubernetesContainerizedImpl class.
|
setUp
|
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
|
@AfterClass
public static void destroyDB() {
try {
dbOperator.update("DROP ALL OBJECTS");
dbOperator.update("SHUTDOWN");
} catch (final SQLException e) {
e.printStackTrace();
}
}
|
This class covers unit tests for KubernetesContainerizedImpl class.
|
destroyDB
|
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.props.put(ContainerizedDispatchManagerProperties.KUBERNETES_NAMESPACE, "dev-namespace");
this.props.put(ContainerizedDispatchManagerProperties.KUBERNETES_KUBE_CONFIG_PATH, "src/test"
+ "/resources/container/kubeconfig");
this.props.put(ContainerizedDispatchManagerProperties.KUBERNETES_SERVICE_REQUIRED, "true");
// Do not enable VPA recommender by default in this unit test unless manually ramped up.
this.props.put(ContainerizedDispatchManagerProperties.KUBERNETES_VPA_RAMPUP, 0);
this.props.put(ContainerizedDispatchManagerProperties.KUBERNETES_FLOW_CONTAINER_CPU_REQUEST,
CPU_REQUESTED_IN_PROPS);
this.props.put(ContainerizedDispatchManagerProperties.KUBERNETES_FLOW_CONTAINER_MEMORY_REQUEST
, MEMORY_REQUESTED_IN_PROPS);
this.props.put(ContainerizedDispatchManagerProperties.KUBERNETES_FLOW_CONTAINER_MIN_ALLOWED_CPU,
MIN_ALLOWED_CPU);
this.props.put(ContainerizedDispatchManagerProperties.KUBERNETES_FLOW_CONTAINER_MIN_ALLOWED_MEMORY,
MIN_ALLOWED_MEMORY);
this.props.put(ContainerizedDispatchManagerProperties.KUBERNETES_FLOW_CONTAINER_MAX_ALLOWED_CPU,
MAX_ALLOWED_CPU);
this.props.put(ContainerizedDispatchManagerProperties.KUBERNETES_FLOW_CONTAINER_MAX_ALLOWED_MEMORY,
MAX_ALLOWED_MEMORY);
this.jobTypePrefetchUserMap =
ContainerImplUtils.parseJobTypeUsersForFlow(this.JOBTYPE_PROXY_USER_MAP);
this.executorLoader = mock(ExecutorLoader.class);
this.projectLoader = mock(ProjectLoader.class);
this.vpaRecommender = mock(VPARecommender.class);
this.loader = new JdbcVersionSetLoader(this.dbOperator);
this.client = mock(ApiClient.class);
SERVICE_PROVIDER.unsetInjector();
SERVICE_PROVIDER.setInjector(getInjector(this.props));
this.flowStatusChangeEventListener = new FlowStatusChangeEventListener(this.props);
this.containerizationMetrics = new DummyContainerizationMetricsImpl();
this.kubernetesContainerizedImpl = new KubernetesContainerizedImpl(this.props,
this.executorLoader, this.loader, this.imageRampupManager, null,
flowStatusChangeEventListener, containerizationMetrics, null, this.vpaRecommender,
this.client);
}
|
This class covers unit tests for KubernetesContainerizedImpl class.
|
setup
|
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
|
@Test
public void testCPUAndMemoryRequestedInFlowParam() throws Exception {
// User requested cpu and memory that are below max allowed cpu and memory and exceed min
// allowed cpu and memory
final Map<String, String> flowParam = new HashMap<>();
final String cpuRequestedInFlowParam = "3";
final String memoryRequestedInFlowParam = "6Gi";
flowParam.put(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_CPU_REQUEST, cpuRequestedInFlowParam);
flowParam
.put(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_MEMORY_REQUEST, memoryRequestedInFlowParam);
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerCPURequest(flowParam, null)
.equals(cpuRequestedInFlowParam));
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerMemoryRequest(flowParam, null)
.equals(memoryRequestedInFlowParam));
// cpu and memory limit are determined dynamically based on requested cpu and memory
String expectedCPULimit =
this.kubernetesContainerizedImpl
.getResourceLimitFromResourceRequest(cpuRequestedInFlowParam, CPU_REQUESTED_IN_PROPS,
CPU_LIMIT_MULTIPLIER);
String expectedMemoryLimit =
this.kubernetesContainerizedImpl
.getResourceLimitFromResourceRequest(memoryRequestedInFlowParam, MEMORY_REQUESTED_IN_PROPS,
MEMORY_LIMIT_MULTIPLIER);
Assert.assertTrue(expectedCPULimit.equals(cpuRequestedInFlowParam));
Assert.assertTrue(expectedMemoryLimit.equals(memoryRequestedInFlowParam));
// User requested cpu and memory that exceed max allowed cpu and memory
final String greaterThanMaxCPURequestedInFlowParam = "5";
final String greaterThanMaxMemoryRequestedInFlowParam = "80Gi";
flowParam.put(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_CPU_REQUEST,
greaterThanMaxCPURequestedInFlowParam);
flowParam.put(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_MEMORY_REQUEST,
greaterThanMaxMemoryRequestedInFlowParam);
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerCPURequest(flowParam, null)
.equals(MAX_ALLOWED_CPU));
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerMemoryRequest(flowParam, null).equals(MAX_ALLOWED_MEMORY));
// User requested cpu and memory that are below max allowed cpu and memory
final String lessThanMinCPURequestedInFlowParam = "1m";
final String lessThanMinMemoryRequestedInFlowParam = "1Mi";
flowParam.put(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_CPU_REQUEST,
lessThanMinCPURequestedInFlowParam);
flowParam.put(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_MEMORY_REQUEST,
lessThanMinMemoryRequestedInFlowParam);
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerCPURequest(flowParam, null)
.equals(MIN_ALLOWED_CPU));
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerMemoryRequest(flowParam,
null).equals(MIN_ALLOWED_MEMORY));
// cpu and memory limit are determined dynamically based on requested cpu and memory
expectedCPULimit =
this.kubernetesContainerizedImpl
.getResourceLimitFromResourceRequest(MAX_ALLOWED_CPU, CPU_REQUESTED_IN_PROPS,
CPU_LIMIT_MULTIPLIER);
expectedMemoryLimit =
this.kubernetesContainerizedImpl
.getResourceLimitFromResourceRequest(MAX_ALLOWED_MEMORY, MEMORY_REQUESTED_IN_PROPS,
MEMORY_LIMIT_MULTIPLIER);
Assert.assertTrue(expectedCPULimit.equals(MAX_ALLOWED_CPU));
Assert.assertTrue(expectedMemoryLimit.equals(MAX_ALLOWED_MEMORY));
// User requested memory of different unit, e.g. Ti, Mi
final String MemoryRequestedInFlowParam1 = "7600Mi";
flowParam.put(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_MEMORY_REQUEST,
MemoryRequestedInFlowParam1);
// 7600 Mi = 7.6 Gi is smaller than max allowed memory and higher than min allowed memory, user
// requested memory should/be used
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerMemoryRequest(flowParam,
null).equals(MemoryRequestedInFlowParam1));
final String MemoryRequestedInFlowParam2 = "0.1Ti";
flowParam.put(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_MEMORY_REQUEST,
MemoryRequestedInFlowParam2);
// 0.1 Ti = 100 Gi > max allowed memory 32 Gi, user requested memory is replaced by max
// allowed memory
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerMemoryRequest(flowParam,
null).equals(MAX_ALLOWED_MEMORY));
// the memory request set by config should be used to get limit
expectedMemoryLimit =
this.kubernetesContainerizedImpl
.getResourceLimitFromResourceRequest(MEMORY_REQUESTED_IN_PROPS, MEMORY_REQUESTED_IN_PROPS,
MEMORY_LIMIT_MULTIPLIER);
Assert.assertTrue(expectedMemoryLimit.equals(MEMORY_REQUESTED_IN_PROPS));
}
|
This test is used to verify that if cpu and memory for a flow container is requested from flow
parameter then that is given more precedence over system configuration, the constraints are
max allowed cpu and memory set in config.
@throws Exception
|
testCPUAndMemoryRequestedInFlowParam
|
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
|
@Test
public void testCPUAndMemoryRequestedFromVPARecommender() throws Exception {
// Fully ramp up VPA so VPA is allowed to give resource recommendations to all flows.
this.kubernetesContainerizedImpl.setVPARampUp(100);
final Map<String, String> emptyFlowParam = new HashMap<>();
final Map<String, String> defaultFlowParam = new HashMap<>();
final String cpuRequestedInFlowParam = "3";
final String memoryRequestedInFlowParam = "6Gi";
defaultFlowParam.put(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_CPU_REQUEST, cpuRequestedInFlowParam);
defaultFlowParam
.put(FlowParameters.FLOW_PARAM_FLOW_CONTAINER_MEMORY_REQUEST, memoryRequestedInFlowParam);
// flow resource recommendation cannot be less than min allowed resource limits
final FlowResourceRecommendation tooSmallFlowResourceRecommendation = new FlowResourceRecommendation(1, 1, "flow",
"1m", "1Mi", null);
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerCPURequest(emptyFlowParam,
tooSmallFlowResourceRecommendation.getCpuRecommendation()).equals(MIN_ALLOWED_CPU));
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerMemoryRequest(emptyFlowParam,
tooSmallFlowResourceRecommendation.getMemoryRecommendation()).equals(MIN_ALLOWED_MEMORY));
// flow resource recommendation cannot be greater than max allowed resource limits
final FlowResourceRecommendation tooLargeFlowResourceRecommendation = new FlowResourceRecommendation(1, 1, "flow",
"20", "1Ti", null);
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerCPURequest(emptyFlowParam,
tooLargeFlowResourceRecommendation.getCpuRecommendation()).equals(MAX_ALLOWED_CPU));
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerMemoryRequest(emptyFlowParam,
tooLargeFlowResourceRecommendation.getMemoryRecommendation()).equals(MAX_ALLOWED_MEMORY));
// max of flow resource recommendation and flow param will be taken
final FlowResourceRecommendation lessThanFlowParamFlowResourceRecommendation = new FlowResourceRecommendation(1, 1,
"flow", "2", "5Gi", null);
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerCPURequest(defaultFlowParam,
lessThanFlowParamFlowResourceRecommendation.getCpuRecommendation()).equals(cpuRequestedInFlowParam));
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerMemoryRequest(defaultFlowParam,
lessThanFlowParamFlowResourceRecommendation.getMemoryRecommendation()).equals(memoryRequestedInFlowParam));
// max of flow resource recommendation and flow param will be taken
final FlowResourceRecommendation greaterThanFlowParamFlowResourceRecommendation = new FlowResourceRecommendation(1, 1,
"flow", "4", "7Gi", null);
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerCPURequest(defaultFlowParam,
greaterThanFlowParamFlowResourceRecommendation.getCpuRecommendation()).equals(greaterThanFlowParamFlowResourceRecommendation.getCpuRecommendation()));
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerMemoryRequest(defaultFlowParam,
greaterThanFlowParamFlowResourceRecommendation.getMemoryRecommendation()).equals(greaterThanFlowParamFlowResourceRecommendation.getMemoryRecommendation()));
// Reset it back to 0 for other unit tests.
this.kubernetesContainerizedImpl.setVPARampUp(0);
}
|
This test is used to verify that if CPU and memory for a flow container is not requested in
flow param but is obtained from VPA recommender.
@throws Exception
|
testCPUAndMemoryRequestedFromVPARecommender
|
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
|
@Test
public void testCPUAndMemoryRequestedFromProperties() throws Exception {
final Map<String, String> flowParam = new HashMap<>();
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerCPURequest(flowParam,
null).equals(CPU_REQUESTED_IN_PROPS));
Assert.assertTrue(this.kubernetesContainerizedImpl.getFlowContainerMemoryRequest(flowParam,
null).equals(MEMORY_REQUESTED_IN_PROPS));
// cpu and memory limit are determined dynamically based on requested cpu and memory
final String expectedCPULimit =
this.kubernetesContainerizedImpl
.getResourceLimitFromResourceRequest(CPU_REQUESTED_IN_PROPS, CPU_REQUESTED_IN_PROPS,
CPU_LIMIT_MULTIPLIER);
Assert.assertTrue(expectedCPULimit.equals(CPU_REQUESTED_IN_PROPS));
final String expectedMemoryLimit =
this.kubernetesContainerizedImpl
.getResourceLimitFromResourceRequest(MEMORY_REQUESTED_IN_PROPS, MEMORY_REQUESTED_IN_PROPS,
MEMORY_LIMIT_MULTIPLIER);
Assert.assertTrue(expectedMemoryLimit.equals(MEMORY_REQUESTED_IN_PROPS));
}
|
This test is used to verify that if CPU and memory for a flow container is not requested
either in flow param or VPA recommender but defined in system configuration then that is used.
@throws Exception
|
testCPUAndMemoryRequestedFromProperties
|
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
|
@Test
public void testPodEnvVariablesFromFlowParam() throws Exception {
final String azkabanBaseVersion = "azkaban-base.version";
final String azkabanConfigVersion = "azkaban-config.version";
final Map<String, String> flowParam = new HashMap<>();
flowParam.put(FlowParameters.FLOW_PARAM_POD_ENV_VAR + azkabanBaseVersion, "1.0.0");
flowParam.put(FlowParameters.FLOW_PARAM_POD_ENV_VAR + azkabanConfigVersion, "0.1.0");
flowParam.put("any.other.param", "test");
final Map<String, String> envVariables = new HashMap<>();
this.kubernetesContainerizedImpl.setupPodEnvVariables(envVariables, flowParam);
assert (envVariables.size() == 2);
assert (envVariables.get(azkabanBaseVersion.toUpperCase()).equals("1.0.0"));
assert (envVariables.get(azkabanConfigVersion.toUpperCase()).equals("0.1.0"));
}
|
This test is used to verify that if env variables are set correctly for pod which are set from
flow param.
@throws Exception
|
testPodEnvVariablesFromFlowParam
|
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
|
@Test
public void testNoPodEnvVariablesFromFlowParam() throws Exception {
final Map<String, String> flowParam = new HashMap<>();
flowParam.put("azkaban-base.version", "1.0.0");
flowParam.put("azkaban-config.version", "0.1.0");
flowParam.put("any.other.param", "test");
final Map<String, String> envVariables = new HashMap<>();
this.kubernetesContainerizedImpl.setupPodEnvVariables(envVariables, flowParam);
assert (envVariables.size() == 0);
}
|
This test is used to verify that if no env variables is set correctly for pod which are set
from flow param.
@throws Exception
|
testNoPodEnvVariablesFromFlowParam
|
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
|
@Test
public void testJobTypesInFlow() throws Exception {
final ExecutableFlow flow = createTestFlow();
flow.setSubmitUser("testUser1");
flow.setStatus(Status.PREPARING);
flow.setSubmitTime(System.currentTimeMillis());
flow.setExecutionId(0);
final TreeSet<String> jobTypes = ContainerImplUtils.getJobTypesForFlow(flow);
assertThat(jobTypes.size()).isEqualTo(1);
}
|
This test is used to verify that if no env variables is set correctly for pod which are set
from flow param.
@throws Exception
|
testJobTypesInFlow
|
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
|
@Test
public void testNoJobTypeIfJobIsDisabledInFlow() throws Exception {
final ExecutableFlow flow = createTestFlow();
flow.setSubmitUser("testUser1");
flow.setStatus(Status.PREPARING);
flow.setSubmitTime(System.currentTimeMillis());
flow.setExecutionId(0);
// Set all jobs in the flow to be in DISABLED status
flow.getExecutableNodes().forEach(executableNode -> executableNode.setStatus(Status.DISABLED));
final TreeSet<String> jobTypes = ContainerImplUtils.getJobTypesForFlow(flow);
assertThat(jobTypes.size()).isEqualTo(0);
}
|
This test is used to verify that if no env variables is set correctly for pod which are set
from flow param.
@throws Exception
|
testNoJobTypeIfJobIsDisabledInFlow
|
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
|
@Test
public void testPodConstruction() throws Exception {
final ExecutableFlow flow = createFlowWithMultipleJobtypes();
flow.setExecutionId(1);
when(this.executorLoader.fetchExecutableFlow(flow.getExecutionId())).thenReturn(flow);
when(imageRampupManager.getVersionByImageTypes(any(), any(Set.class), any(Set.class)))
.thenReturn(getVersionMap());
final TreeSet<String> jobTypes = ContainerImplUtils.getJobTypesForFlow(flow);
final Set<String> dependencyTypes = ImmutableSet.of(DEPENDENCY1);
assert (jobTypes.contains("command"));
assert (jobTypes.contains("hadoopJava"));
assert (jobTypes.contains("spark"));
log.info("Jobtypes for flow {} are: {}", flow.getFlowId(), jobTypes);
final Map<String, String> flowParam = new HashMap<>(); // empty map
final Set<String> allImageTypes = new TreeSet<>();
allImageTypes.add(KubernetesContainerizedImpl.DEFAULT_AZKABAN_BASE_IMAGE_NAME);
allImageTypes.add(KubernetesContainerizedImpl.DEFAULT_AZKABAN_CONFIG_IMAGE_NAME);
allImageTypes.addAll(jobTypes);
allImageTypes.addAll(dependencyTypes);
final VersionSet versionSet = this.kubernetesContainerizedImpl
.fetchVersionSet(flow.getExecutionId(), flowParam, allImageTypes, flow);
final V1PodSpec podSpec = this.kubernetesContainerizedImpl
.createPodSpec(flow, DEFAULT_FLOW_RECOMMENDATION, DEFAULT_FLOW_RECOMMENDATION_MAP,
versionSet, jobTypes, dependencyTypes, flowParam);
final V1ObjectMeta podMetadata =
this.kubernetesContainerizedImpl.createPodMetadata(flow, DEFAULT_FLOW_RECOMMENDATION.getId(),
flowParam);
// Set custom labels and annotations
ImmutableMap<String, String> annotations = ImmutableMap.of(
"akey1", "aval1",
"akey2", "aval2");
ImmutableMap<String, String> labels = ImmutableMap.of(
"lkey1", "lvalue1",
"lkey2", "lvalue2");
podMetadata.getAnnotations().putAll(annotations);
podMetadata.getLabels().putAll(labels);
assert (podSpec != null);
assert (podMetadata != null);
// Verifying if empty string were removed from the list
final V1Pod pod1 =
this.kubernetesContainerizedImpl.createPodFromMetadataAndSpec(podMetadata, podSpec);
final String createdPodSpec1 = Yaml.dump(pod1).trim();
String readPodSpec1 = TestUtils.readResource("v1PodTest1.yaml", this).trim();
log.info("Resulting pod spec: {}", flow.getExecutionId(), createdPodSpec1);
Assert.assertEquals(readPodSpec1, createdPodSpec1);
log.info("Resulting pod spec: {}", flow.getExecutionId(), createdPodSpec1);
// Merge the pod created earlier with an externally provided pod template
AzKubernetesV1PodTemplate podTemplate = AzKubernetesV1PodTemplate.getInstance(
this.getClass().getResource("v1PodTestTemplate1.yaml").getFile());
V1PodSpec podSpecFromTemplate = podTemplate.getPodSpecFromTemplate();
V1ObjectMeta podMetadataFromTemplate = podTemplate.getPodMetadataFromTemplate();
PodTemplateMergeUtils.mergePodSpec(podSpec, podSpecFromTemplate);
PodTemplateMergeUtils.mergePodMetadata(podMetadata, podMetadataFromTemplate);
V1Pod pod2 = new AzKubernetesV1PodBuilder(podMetadata, podSpec).build();
String createdPodSpec2 = Yaml.dump(pod2).trim();
String readPodSpec2 = TestUtils.readResource("v1PodTest2.yaml", this).trim();
Assert.assertEquals(readPodSpec2, createdPodSpec2);
log.info("Resulting pod spec merged with template: {}", createdPodSpec2);
// Verify that the number of "volumeMounts" in podSpecFromTemplate after merge is 4
// (1 from v1PodTestTemplate1.yaml + 3 from v1PodTest1.yaml)
Assert.assertEquals(4, podSpecFromTemplate.getContainers().get(0)
.getVolumeMounts().size());
// Verify that the number of "volumeMounts" in a new podSpecFromTemplate is 2 and hence
// it is not corrupted by the previous merge.
podTemplate = AzKubernetesV1PodTemplate.getInstance(
this.getClass().getResource("v1PodTestTemplate1.yaml").getFile());
podSpecFromTemplate = podTemplate.getPodSpecFromTemplate();
Assert.assertEquals(2, podSpecFromTemplate.getContainers().get(0)
.getVolumeMounts().size());
}
|
This test is used to verify that if no env variables is set correctly for pod which are set
from flow param.
@throws Exception
|
testPodConstruction
|
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
|
@Test
public void testVersionSetConstructionWithFlowOverrideParams() throws Exception {
final ExecutableFlow flow = createFlowWithMultipleJobtypes();
flow.setExecutionId(2);
when(this.executorLoader.fetchExecutableFlow(flow.getExecutionId())).thenReturn(flow);
when(imageRampupManager.getVersionByImageTypes(any(), any(Set.class), any(Set.class)))
.thenReturn(getVersionMap());
when(imageRampupManager
.getVersionInfo(any(String.class), any(String.class), any(Set.class)))
.thenReturn(new VersionInfo("7.0.4", "path1", State.ACTIVE));
final TreeSet<String> jobTypes = ContainerImplUtils.getJobTypesForFlow(flow);
// Add included job types
jobTypes.add("hadoopJava");
jobTypes.add("pig");
jobTypes.add("pigLi-0.11.1");
// Add azkaban base image and config
final Set<String> allImageTypes = new TreeSet<>();
allImageTypes.add(KubernetesContainerizedImpl.DEFAULT_AZKABAN_BASE_IMAGE_NAME);
allImageTypes.add(KubernetesContainerizedImpl.DEFAULT_AZKABAN_CONFIG_IMAGE_NAME);
allImageTypes.addAll(jobTypes);
final VersionSetBuilder versionSetBuilder = new VersionSetBuilder(this.loader);
final VersionSet presetVersionSet = versionSetBuilder
.addElement("azkaban-base", new VersionInfo("7.0.4", "path1", State.ACTIVE))
.addElement("azkaban-config", new VersionInfo("9.1.1", "path2", State.ACTIVE))
.addElement("spark", new VersionInfo("8.0", "path3", State.ACTIVE))
.addElement("kafkaPush", new VersionInfo("7.1", "path4", State.ACTIVE))
.build();
final Map<String, String> flowParam = new HashMap<>();
flowParam.put(Constants.FlowParameters.FLOW_PARAM_VERSION_SET_ID,
String.valueOf(presetVersionSet.getVersionSetId()));
VersionSet versionSet = this.kubernetesContainerizedImpl
.fetchVersionSet(flow.getExecutionId(), flowParam, allImageTypes, flow);
assert (versionSet.getVersion("kafkaPush").get()
.equals(presetVersionSet.getVersion("kafkaPush").get()));
assert (versionSet.getVersion("spark").get()
.equals(presetVersionSet.getVersion("spark").get()));
assert (versionSet.getVersion("azkaban-base").get()
.equals(presetVersionSet.getVersion("azkaban-base").get()));
assert (versionSet.getVersion("azkaban-config").get()
.equals(presetVersionSet.getVersion("azkaban-config").get()));
// Included jobs in the azkaban base image, so must not present in versionSet.
Assert.assertEquals(false, versionSet.getVersion("hadoopJava").isPresent());
Assert.assertEquals(false, versionSet.getVersion("pig").isPresent());
Assert.assertEquals(false, versionSet.getVersion("pigLi-0.11.1").isPresent());
// Now let's try constructing an incomplete versionSet
final VersionSetBuilder incompleteVersionSetBuilder = new VersionSetBuilder(this.loader);
final VersionSet incompleteVersionSet = incompleteVersionSetBuilder
.addElement("kafkaPush", new VersionInfo("7.1", "path1", State.ACTIVE))
.addElement("spark", new VersionInfo("8.0", "path2", State.ACTIVE))
.build();
flowParam.put(Constants.FlowParameters.FLOW_PARAM_VERSION_SET_ID,
String.valueOf(incompleteVersionSet.getVersionSetId()));
flowParam.put(String.join(".",
KubernetesContainerizedImpl.IMAGE, "azkaban-base", KubernetesContainerizedImpl.VERSION),
"7.0.4");
versionSet = this.kubernetesContainerizedImpl
.fetchVersionSet(flow.getExecutionId(), flowParam, allImageTypes, flow);
assert (versionSet.getVersion("kafkaPush").get()
.equals(presetVersionSet.getVersion("kafkaPush").get()));
assert (versionSet.getVersion("spark").get()
.equals(presetVersionSet.getVersion("spark").get()));
assert (versionSet.getVersion("azkaban-base").get().getVersion().equals("7.0.4"));
assert (versionSet.getVersion("azkaban-config").get().getVersion().equals("9.1.1"));
}
|
This test is used to verify that if no env variables is set correctly for pod which are set
from flow param.
@throws Exception
|
testVersionSetConstructionWithFlowOverrideParams
|
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
|
@Test
public void testVersionSetConstructionWithRampupManager() throws Exception {
final ExecutableFlow flow = createFlowWithMultipleJobtypes();
flow.setExecutionId(2);
when(this.executorLoader.fetchExecutableFlow(flow.getExecutionId())).thenReturn(flow);
when(imageRampupManager.getVersionByImageTypes(any(), any(Set.class), any(Set.class)))
.thenReturn(getVersionMap());
final TreeSet<String> jobTypes = ContainerImplUtils.getJobTypesForFlow(flow);
final Set<String> dependencyTypes = ImmutableSet.of(DEPENDENCY1);
// Add included job types
jobTypes.add("hadoopJava");
jobTypes.add("pig");
jobTypes.add("pigLi-0.11.1");
jobTypes.add("noop");
// Add azkaban base image and config
final Set<String> allImageTypes = new TreeSet<>();
allImageTypes.add(KubernetesContainerizedImpl.DEFAULT_AZKABAN_BASE_IMAGE_NAME);
allImageTypes.add(KubernetesContainerizedImpl.DEFAULT_AZKABAN_CONFIG_IMAGE_NAME);
allImageTypes.addAll(jobTypes);
allImageTypes.addAll(dependencyTypes);
final Map<String, String> flowParam = new HashMap<>();
final VersionSet versionSet = this.kubernetesContainerizedImpl
.fetchVersionSet(flow.getExecutionId(), flowParam, allImageTypes, flow);
// Included jobs in the azkaban base image, so must not present in versionSet.
Assert.assertEquals(false, versionSet.getVersion("hadoopJava").isPresent());
Assert.assertEquals(false, versionSet.getVersion("pig").isPresent());
Assert.assertEquals(false, versionSet.getVersion("pigLi-0.11.1").isPresent());
Assert.assertEquals(false, versionSet.getVersion("noop").isPresent());
Assert.assertEquals("7.0.4", versionSet.getVersion("azkaban-base").get().getVersion());
Assert.assertEquals("9.1.1", versionSet.getVersion("azkaban-config").get().getVersion());
Assert.assertEquals("8.0", versionSet.getVersion("spark").get().getVersion());
Assert.assertEquals("7.1", versionSet.getVersion("kafkaPush").get().getVersion());
Assert.assertEquals("6.4", versionSet.getVersion("dependency1").get().getVersion());
}
|
This test is used to verify that if no env variables is set correctly for pod which are set
from flow param.
@throws Exception
|
testVersionSetConstructionWithRampupManager
|
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
|
@Test
public void testPopulatingProxyUsersFromFlowParamOnly() throws Exception {
final ExecutableFlow flow = createTestFlow();
flow.setProjectId(1);
ProjectManager projectManager = mock(ProjectManager.class);
Project project = mock(Project.class);
Flow flowObj = mock(Flow.class);
when(flowObj.toString()).thenReturn(flow.getFlowName());
ExecutableNode node1 = new ExecutableNode();
node1.setId("node1");
node1.setJobSource("job1");
node1.setStatus(Status.PREPARING);
Props currentNodeProps1 = new Props();
Props currentNodeJobProps1 = new Props();
when(projectManager.getProject(flow.getProjectId())).thenReturn(project);
when(project.getFlow(flow.getFlowId())).thenReturn(flowObj);
when(projectManager.getProperties(project, flowObj, node1.getId(), node1.getJobSource()))
.thenReturn(currentNodeProps1);
when(projectManager.getJobOverrideProperty(project, flowObj, node1.getId(),
node1.getJobSource()))
.thenReturn(currentNodeJobProps1);
Map<String, String> flowParams = new HashMap<>();
flowParams.put("user.to.proxy", "testuser1");
Set<String> proxyUsers = new HashSet<>(getProxyUsersForFlow(projectManager, flow, flowParams));
Assert.assertTrue(proxyUsers.contains("testuser1"));
}
|
This test is used to verify that if no env variables is set correctly for pod which are set
from flow param.
@throws Exception
|
testPopulatingProxyUsersFromFlowParamOnly
|
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
|
@Test
public void testPopulatingProxyUsersFromProject() throws Exception {
final ExecutableFlow flow = createTestFlow();
flow.setProjectId(1);
ProjectManager projectManager = mock(ProjectManager.class);
Project project = mock(Project.class);
Flow flowObj = mock(Flow.class);
when(flowObj.toString()).thenReturn(flow.getFlowName());
Set<String> proxyUsers = new HashSet<>();
ExecutableNode node1 = new ExecutableNode();
node1.setId("node1");
node1.setJobSource("job1");
node1.setStatus(Status.PREPARING);
Props currentNodeProps1 = new Props();
Props currentNodeJobProps1 = new Props();
currentNodeProps1.put("user.to.proxy", "testUser1");
currentNodeJobProps1.put("user.to.proxy", "");
when(projectManager.getProject(flow.getProjectId())).thenReturn(project);
when(project.getFlow(flow.getFlowId())).thenReturn(flowObj);
when(projectManager.getProperties(project, flowObj, node1.getId(), node1.getJobSource()))
.thenReturn(currentNodeProps1);
when(projectManager.getJobOverrideProperty(project, flowObj, node1.getId(),
node1.getJobSource()))
.thenReturn(currentNodeJobProps1);
populateProxyUsersForFlow(node1, flowObj, project, projectManager, proxyUsers);
// First test when there's no job override user.
Assert.assertTrue(proxyUsers.contains("testUser1"));
Assert.assertEquals(1, proxyUsers.size());
proxyUsers.clear();
// Test adding a empty string user
currentNodeProps1.put("user.to.proxy", "");
populateProxyUsersForFlow(node1, flowObj, project, projectManager, proxyUsers);
Assert.assertEquals(0, proxyUsers.size());
currentNodeJobProps1.put("user.to.proxy", "overrideUser");
populateProxyUsersForFlow(node1, flowObj, project, projectManager, proxyUsers);
// Second test when there is a job override user.
Assert.assertTrue(proxyUsers.contains("overrideUser"));
Assert.assertEquals(1, proxyUsers.size());
// Third test : Adding a second node and testing size of proxy user list to test it has
// overrideUser and testUser2
ExecutableNode node2 = new ExecutableNode();
node2.setId("node2");
node2.setJobSource("job2");
node2.setStatus(Status.PREPARING);
Props currentNodeProps2 = new Props();
Props currentNodeJobProps2 = new Props();
when(projectManager.getProperties(project, flowObj, node2.getId(), node2.getJobSource()))
.thenReturn(currentNodeProps2);
currentNodeProps2.put("user.to.proxy", "testUser2");
currentNodeJobProps2.put("user.to.proxy", "");
when(projectManager.getJobOverrideProperty(project, flowObj, node2.getId(),
node2.getJobSource()))
.thenReturn(currentNodeJobProps2);
populateProxyUsersForFlow(node2, flowObj, project, projectManager, proxyUsers);
Assert.assertTrue(proxyUsers.contains("testUser2"));
Assert.assertEquals(2, proxyUsers.size());
}
|
This test is used to verify that if no env variables is set correctly for pod which are set
from flow param.
@throws Exception
|
testPopulatingProxyUsersFromProject
|
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
|
@Test
public void testPopulatingJobTypeUsersForFlow() throws Exception {
Set<String> proxyUsers;
TreeSet<String> jobTypes = new TreeSet<>();
jobTypes.add("jobtype1");
proxyUsers = getJobTypeUsersForFlow(jobTypePrefetchUserMap, jobTypes);
Assert.assertTrue(proxyUsers.contains("jobtype1_proxyuser"));
Assert.assertEquals(1, proxyUsers.size());
jobTypes.add("jobtype2");
proxyUsers = getJobTypeUsersForFlow(jobTypePrefetchUserMap, jobTypes);
Assert.assertTrue(proxyUsers.contains("jobtype1_proxyuser"));
Assert.assertTrue(proxyUsers.contains("jobtype2_proxyuser"));
Assert.assertEquals(2, proxyUsers.size());
}
|
This test is used to verify that if no env variables is set correctly for pod which are set
from flow param.
@throws Exception
|
testPopulatingJobTypeUsersForFlow
|
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
|
@Test
public void testPreparingFlowEvent() throws Exception {
final ExecutableFlow flow = createFlowWithMultipleJobtypes();
flow.setExecutionId(2);
when(this.executorLoader.fetchExecutableFlow(flow.getExecutionId())).thenReturn(flow);
when(imageRampupManager.getVersionByImageTypes(any(), any(Set.class), any(Set.class)))
.thenReturn(getVersionMap());
final TreeSet<String> jobTypes = ContainerImplUtils.getJobTypesForFlow(flow);
final Map<String, String> flowParam = new HashMap<>(); // empty map
final Set<String> allImageTypes = new TreeSet<>();
allImageTypes.add(KubernetesContainerizedImpl.DEFAULT_AZKABAN_BASE_IMAGE_NAME);
allImageTypes.add(KubernetesContainerizedImpl.DEFAULT_AZKABAN_CONFIG_IMAGE_NAME);
allImageTypes.addAll(jobTypes);
final VersionSet versionSet = this.kubernetesContainerizedImpl
.fetchVersionSet(flow.getExecutionId(), flowParam, allImageTypes, flow);
flow.setStatus(Status.PREPARING);
flow.setVersionSet(versionSet);
// Test event reported from a pod
final Map<String, String> metaData = flowStatusChangeEventListener.getFlowMetaData(flow);
Assert.assertTrue(metaData.get(EXECUTION_ID).equals("2"));
Assert.assertTrue(metaData.get(FLOW_STATUS).equals("PREPARING"));
final String versionSetJsonString = metaData.get(VERSION_SET);
final Map<String, String> imageToVersionMap =
new ObjectMapper().readValue(versionSetJsonString,
new TypeReference<HashMap<String, String>>() {
});
assertThat(imageToVersionMap.keySet()).isEqualTo(versionSet.getImageToVersionMap().keySet());
assertThat(imageToVersionMap.get("spark")).isEqualTo(versionSet.getImageToVersionMap()
.get("spark").getVersion());
assertThat(imageToVersionMap.get(KubernetesContainerizedImpl.DEFAULT_AZKABAN_BASE_IMAGE_NAME))
.isEqualTo(versionSet.getImageToVersionMap()
.get(KubernetesContainerizedImpl.DEFAULT_AZKABAN_BASE_IMAGE_NAME).getVersion());
}
|
Test a preparing flow to be executed in a container, whether the information of execution id,
version set, flow status, can be processed by a PodEventListener
@throws Exception
|
testPreparingFlowEvent
|
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
|
@Test
public void testFlowPropertyAndParamsMerge() throws Exception {
final ExecutableFlow flow = createTestFlow();
flow.setExecutionId(3);
final Props flowProps = new Props();
flowProps.put("param.override.image.version", "1.2.3");
flowProps.put("regular.param", "4.5.6"); // Should be filtered out.
when(this.projectLoader.fetchProjectProperty(
flow.getProjectId(), flow.getVersion(), Constants.PARAM_OVERRIDE_FILE)).thenReturn(flowProps);
final ExecutionOptions executionOptions = new ExecutionOptions();
flow.setExecutionOptions(executionOptions);
final Map<String, String> flowParams = flow.getExecutionOptions().getFlowParameters();
Assert.assertEquals(0, flowParams.size());
// Merge the flow props and flow params
flow.setFlowParamsFromProps(
FlowLoaderUtils.loadPropsForExecutableFlow(this.projectLoader, flow));
final Map<String, String> mergedFlowPropsAndParams = flow.getExecutionOptions().getFlowParameters();
Assert.assertEquals(1, mergedFlowPropsAndParams.size());
Assert.assertTrue(mergedFlowPropsAndParams.containsKey("image.version"));
Assert.assertEquals("1.2.3", mergedFlowPropsAndParams.get("image.version"));
}
|
Test merging of flow properties and flow params.
@throws Exception
|
testFlowPropertyAndParamsMerge
|
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
|
@Test
public void testFlowPropertyAndParamsMergeWithOverwrite() throws Exception {
final ExecutableFlow flow = createTestFlow();
flow.setExecutionId(3);
final Props flowProps = new Props();
flowProps.put("param.override.image.version", "1.2.3");
flowProps.put("regular.param", "4.5.6"); // Should be filtered out.
when(this.projectLoader.fetchProjectProperty(
flow.getProjectId(), flow.getVersion(), Constants.PARAM_OVERRIDE_FILE)).thenReturn(flowProps);
final ExecutionOptions executionOptions = new ExecutionOptions();
flow.setExecutionOptions(executionOptions);
final Map<String, String> flowParams = flow.getExecutionOptions().getFlowParameters();
Assert.assertEquals(0, flowParams.size());
// flow params take priority.
flowParams.put("image.version", "2.3.4");
// Merge the flow props and flow params
flow.setFlowParamsFromProps(
FlowLoaderUtils.loadPropsForExecutableFlow(this.projectLoader, flow));
final Map<String, String> mergedFlowPropsAndParams = flow.getExecutionOptions().getFlowParameters();
Assert.assertEquals(1, mergedFlowPropsAndParams.size());
Assert.assertTrue(mergedFlowPropsAndParams.containsKey("image.version"));
Assert.assertEquals("1.2.3", mergedFlowPropsAndParams.get("image.version"));
}
|
Test merging of flow properties and flow params where flow params override the flow property.
@throws Exception
|
testFlowPropertyAndParamsMergeWithOverwrite
|
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
|
@Test
public void testFlowPropertyAndParamsMergeNull() throws Exception {
final ExecutableFlow flow = createTestFlow();
flow.setExecutionId(3);
when(this.projectLoader.fetchProjectProperty(
flow.getProjectId(), flow.getVersion(), Constants.PARAM_OVERRIDE_FILE)).thenReturn(null);
final ExecutionOptions executionOptions = new ExecutionOptions();
flow.setExecutionOptions(executionOptions);
final Map<String, String> flowParams = flow.getExecutionOptions().getFlowParameters();
Assert.assertEquals(0, flowParams.size());
// flow params take priority.
flowParams.put("image.version", "2.3.4");
// Merge the flow props and flow params
flow.setFlowParamsFromProps(
FlowLoaderUtils.loadPropsForExecutableFlow(this.projectLoader, flow));
final Map<String, String> mergedFlowPropsAndParams = flow.getExecutionOptions().getFlowParameters();
Assert.assertEquals(1, mergedFlowPropsAndParams.size());
Assert.assertTrue(mergedFlowPropsAndParams.containsKey("image.version"));
Assert.assertEquals("2.3.4", mergedFlowPropsAndParams.get("image.version"));
}
|
Test merging of flow properties and flow params where props in null.
@throws Exception
|
testFlowPropertyAndParamsMergeNull
|
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
|
@Test
public void testGetExecutionIdFromPodList() throws Exception{
final V1PodList podList = new V1PodList();
final OffsetDateTime validStartTimeStamp = OffsetDateTime.now();
// stale pod 1 with execution id information
final V1ObjectMeta podMetadata1 = new V1ObjectMeta();
final ImmutableMap<String, String> label1 = ImmutableMap.of(
"execution-id", "execid-123");
podMetadata1.setLabels(label1);
podMetadata1.setCreationTimestamp(validStartTimeStamp.minus(1, ChronoUnit.MILLIS));
final V1Pod pod1 = new AzKubernetesV1PodBuilder(podMetadata1, null).build();
// stale pod 2 without execution id information
final V1ObjectMeta podMetadata2 = new V1ObjectMeta();
final ImmutableMap<String, String> label2 = ImmutableMap.of(
"key2", "val2");
podMetadata2.setLabels(label2);
podMetadata2.setCreationTimestamp(validStartTimeStamp.minus(1, ChronoUnit.MILLIS));
final V1Pod pod2 = new AzKubernetesV1PodBuilder(podMetadata2, null).build();
// valid pod 3 with execution id information
final V1ObjectMeta podMetadata3 = new V1ObjectMeta();
final ImmutableMap<String, String> label3 = ImmutableMap.of(
"execution-id", "execid-12345");
podMetadata3.setLabels(label3);
podMetadata3.setCreationTimestamp(validStartTimeStamp.plus(1, ChronoUnit.MILLIS));
final V1Pod pod3 = new AzKubernetesV1PodBuilder(podMetadata3, null).build();
podList.addItemsItem(pod1);
podList.addItemsItem(pod2);
podList.addItemsItem(pod3);
final Set<Integer> staleContainerExecIdSet =
this.kubernetesContainerizedImpl.getExecutionIdsFromPodList(podList,
validStartTimeStamp);
Assert.assertTrue(staleContainerExecIdSet.contains(123));
Assert.assertFalse(staleContainerExecIdSet.contains(-1));
Assert.assertFalse(staleContainerExecIdSet.contains(12345));
}
|
Test get execution id set from pod list
@throws Exception
|
testGetExecutionIdFromPodList
|
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 ExecutableFlow createTestFlow() throws Exception {
return TestUtils.createTestExecutableFlow("exectest1", "exec1", DispatchMethod.CONTAINERIZED);
}
|
Test get execution id set from pod list
@throws Exception
|
createTestFlow
|
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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.