Skip to content

Commit

Permalink
merging execute-as-user with azkaban3
Browse files Browse the repository at this point in the history
  • Loading branch information
John Yu committed Nov 13, 2015
1 parent f701f78 commit b304f43
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public class ExecutorManager extends EventHandler implements
private ExecutingManagerUpdaterThread executingManager;
// 12 weeks
private static final long DEFAULT_EXECUTION_LOGS_RETENTION_MS = 3 * 4 * 7
* 24 * 60 * 60 * 1000l;
* 24 * 60 * 60 * 1000L;
private long lastCleanerThreadCheckTime = -1;

private long lastThreadCheckTime = -1;
Expand Down Expand Up @@ -1988,4 +1988,4 @@ private void handleNoExecutorSelectedCase(ExecutionReference reference,
queuedFlows.enqueue(exflow, reference);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private synchronized void uploadExecutableFlow(Connection connection,
runner.query(connection, LastInsertID.LAST_INSERT_ID,
new LastInsertID());

if (id == -1l) {
if (id == -1L) {
throw new ExecutorManagerException(
"Execution id is not properly created.");
}
Expand Down Expand Up @@ -1061,7 +1061,7 @@ private static class LastInsertID implements ResultSetHandler<Long> {
@Override
public Long handle(ResultSet rs) throws SQLException {
if (!rs.next()) {
return -1l;
return -1L;
}
long id = rs.getLong(1);
return id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public Project createProject(String projectName, String description,
"Project names must start with a letter, followed by any number of letters, digits, '-' or '_'.");
}

if (projectsByName.contains(projectName)) {
if (projectsByName.containsKey(projectName)) {
throw new ProjectManagerException("Project already exists.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private synchronized void addTrigger(Connection connection, Trigger t,
runner.query(connection, LastInsertID.LAST_INSERT_ID,
new LastInsertID());

if (id == -1l) {
if (id == -1L) {
logger.error("trigger id is not properly created.");
throw new TriggerLoaderException("trigger id is not properly created.");
}
Expand Down Expand Up @@ -257,7 +257,7 @@ private static class LastInsertID implements ResultSetHandler<Long> {
@Override
public Long handle(ResultSet rs) throws SQLException {
if (!rs.next()) {
return -1l;
return -1L;
}

long id = rs.getLong(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Integer getInt(K key, Integer defaultVal) {
}

public Long getLong(K key) {
return getLong(key, -1l);
return getLong(key, -1L);
}

public Long getLong(K key, Long defaultVal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void outputGeneratedProperties(Props outputProperties) {
}
writer.write("}".getBytes());
} catch (Exception e) {
new RuntimeException("Unable to store output properties to: "
throw new RuntimeException("Unable to store output properties to: "
+ outputFileStr);
} finally {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

import azkaban.utils.Props;
Expand Down Expand Up @@ -82,6 +83,7 @@ public static void cleanup() {
Utils.removeFile(scriptFile);
}

@Ignore("Test appears to hang.")
@Test
public void testPythonJob() {

Expand Down
4 changes: 2 additions & 2 deletions azkaban-common/src/test/java/azkaban/project/ProjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public class ProjectTest {
@Test
public void testToAndFromObject() throws Exception {
Project project = new Project(1, "tesTing");
project.setCreateTimestamp(1l);
project.setLastModifiedTimestamp(2l);
project.setCreateTimestamp(1L);
project.setLastModifiedTimestamp(2L);
project.setDescription("I am a test");
project.setUserPermission("user1", new Permission(new Type[] { Type.ADMIN,
Type.EXECUTE }));
Expand Down
125 changes: 0 additions & 125 deletions azkaban-execserver/src/main/resources/execute-as-user.c

This file was deleted.

46 changes: 25 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
buildscript {
repositories {
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'com.linkedin:gradle-dustjs-plugin:1.0.0'
classpath 'de.obqo.gradle:gradle-lesscss-plugin:1.0-1.3.3'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.8'
}
}

Expand Down Expand Up @@ -32,6 +36,11 @@ def cmdCaller = { commandln ->
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'net.ltgt.errorprone'

configurations.errorprone {
resolutionStrategy.force 'com.google.errorprone:error_prone_core:2.0.5'
}

/**
* Gets the version name from the latest Git tag
Expand Down Expand Up @@ -78,21 +87,8 @@ project(':azkaban-common') {
all {
transitive = false
}
}

apply plugin: 'c'
model {
components {
main(NativeExecutableSpec) {
sources {
c {
source {
srcDir "src/main"
include "**/*.c"
}
}
}
}
errorprone {
transitive = true
}
}

Expand Down Expand Up @@ -131,18 +127,21 @@ project(':azkaban-common') {
testCompile('junit:junit:4.11')
testCompile('org.hamcrest:hamcrest-all:1.3')
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}

}

project(':azkaban-migration') {
configurations {
all {
transitive = false
}
errorprone {
transitive = true
}
}

dependencies {
Expand Down Expand Up @@ -191,6 +190,9 @@ project(':azkaban-webserver') {
generateRestli {
transitive = true
}
errorprone {
transitive = true
}
}

dependencies {
Expand Down Expand Up @@ -314,6 +316,9 @@ project(':azkaban-execserver') {
all {
transitive = false
}
errorprone {
transitive = true
}
}

dependencies {
Expand All @@ -329,7 +334,6 @@ project(':azkaban-execserver') {
compile('org.mortbay.jetty:jetty-util:6.1.26')
compile('org.codehaus.jackson:jackson-core-asl:1.9.5')
compile('org.codehaus.jackson:jackson-mapper-asl:1.9.5')


testCompile('junit:junit:4.11')
testCompile('org.hamcrest:hamcrest-all:1.3')
Expand Down Expand Up @@ -499,11 +503,11 @@ project(':azkaban-test') {
}
}

distZip.dependsOn build, animalDistZip, embeddedDistZip, embedded2DistZip,
distZip.dependsOn animalDistZip, embeddedDistZip, embedded2DistZip,
embedded3DistZip, embeddedBadDistZip, execpropstestDistZip,
exectest1DistZip, exectest2DistZip, logtestDistZip

distTar.dependsOn build, animalDistTar, embeddedDistTar, embedded2DistTar,
distTar.dependsOn animalDistTar, embeddedDistTar, embedded2DistTar,
embedded3DistTar, embeddedBadDistTar, execpropstestDistTar,
exectest1DistTar, exectest2DistTar, logtestDistTar
}
Expand Down Expand Up @@ -591,5 +595,5 @@ distZip.dependsOn migrationDistZip, webserverDistZip, execserverDistZip, soloser
* Gradle wrapper task.
*/
task wrapper(type: Wrapper) {
gradleVersion = '1.12'
gradleVersion = '2.7'
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jun 11 01:55:01 PDT 2014
#Sat Sep 26 15:48:43 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
6 changes: 1 addition & 5 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ case "`uname`" in
;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
Expand Down Expand Up @@ -114,6 +109,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
Expand Down

0 comments on commit b304f43

Please sign in to comment.