aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevi...@apache.org
Subject [2/3] incubator-aurora git commit: Extract thrift into an API subproject.
Date Tue, 25 Nov 2014 22:25:33 GMT
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/buildSrc/src/main/groovy/org/apache/aurora/CoverageReportCheck.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/aurora/CoverageReportCheck.groovy b/buildSrc/src/main/groovy/org/apache/aurora/CoverageReportCheck.groovy
deleted file mode 100644
index f233153..0000000
--- a/buildSrc/src/main/groovy/org/apache/aurora/CoverageReportCheck.groovy
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import org.gradle.api.DefaultTask
-import org.gradle.api.GradleException
-import org.gradle.api.tasks.TaskAction
-
-/**
- * A task that analyzes the XML coverage report from JaCoCo and fails the build if code coverage
- * metrics are not met.
- */
-class CoverageReportCheck extends DefaultTask {
-
-  // The XML coverage report file.
-  def coverageReportFile
-
-  // Minimum ratio of instructions covered, [0, 1.0].
-  def minInstructionCoverage
-
-  // Minimum ratio of branches covered, [0, 1.0].
-  def minBranchCoverage
-
-  // Classes that may be allowed to have zero test coverage.
-  def legacyClassesWithoutCoverage
-
-  // The amount of wiggle room when requiring min coverage be raised.
-  def epsilon = 0.005
-
-  private def computeCoverage(counterNodes, type) {
-    def node = counterNodes.find { it.@type == type }
-    def missed = node.@missed.toInteger()
-    def covered = node.@covered.toInteger()
-    return ((double) covered) / (missed + covered)
-  }
-
-  def checkThresholds(coverage, minCoverage, type) {
-    if (coverage < minCoverage) {
-      return "$type coverage is $coverage, but must be greater than $minCoverage"
-    } else {
-      def floored = Math.floor(coverage * 100) / 100
-      if (floored > (minCoverage + epsilon)) {
-        println("$type coverage of $floored exceeds min instruction coverage of $minCoverage"
-            + " by more than $epsilon, please raise the threshold!")
-      } else {
-        println("$type coverage of $coverage exceeds minimum coverage of $minCoverage.")
-      }
-    }
-  }
-
-  def checkGlobalCoverage(coverageCounts) {
-    def coverageErrors = [
-        [computeCoverage(coverageCounts, 'INSTRUCTION'), minInstructionCoverage, 'Instruction'],
-        [computeCoverage(coverageCounts, 'BRANCH'), minBranchCoverage, 'Branch']
-    ].collect() {
-      return checkThresholds(*it)
-    }.findAll()
-
-    if (!coverageErrors.isEmpty()) {
-      throw new GradleException(coverageErrors.join('\n'))
-    }
-  }
-
-  def checkClassCoverage(coverageReport) {
-    def coverageErrors = coverageReport.package.class.collect { cls ->
-      // javac inserts a synthetic constructor for anonymous classes, and jacoco tends to mark
-      // these as covered in some cases, leading to flaky behavior.  We work around that by
-      // collecting the coverage count for each method in each class, omitting the default
-      // constructor for anonymous classes.  Anonymous classes are identified by their name,
-      // which we expect to be of the form 'Something$1'.  Jacoco names default constructors
-      // '<init>', so we filter based on that.
-      def isAnonymous = { c -> c.@name ==~ /.*\$\d+/ }
-      def methodFilter = isAnonymous(cls) ? { m -> m.@name != '<init>' } : { true }
-
-      def matchedMethods = cls.method.findAll(methodFilter)
-      if (isAnonymous(cls) && matchedMethods.isEmpty()) {
-        // Ignore anonymous classes that only have a constructor. This will avoid tripping for
-        // things like TypeLiteral and Clazz.
-        if (cls.@name in legacyClassesWithoutCoverage) {
-          return 'Please remove ' + cls.@name + ' from the legacyClassesWithoutCoverage list' \
-              + ', this check does not apply for constructor-only anonymous classes.'
-        } else {
-          return null
-        }
-      }
-
-      def covered = matchedMethods.collect { m ->
-        m.counter.find({ c -> c.@type == 'INSTRUCTION' }).@covered.toInteger()}.sum(0)
-
-      if (cls.@name in legacyClassesWithoutCoverage) {
-        if (covered != 0) {
-          return 'Thanks for adding the first test coverage to: ' + cls.@name \
-              + ' please remove it from the legacyClassesWithoutCoverage list'
-        }
-      } else if (covered == 0) {
-        return 'Test coverage missing for ' + cls.@name
-      }
-      return null
-    }.findAll()  // Filter nulls.
-    if (!coverageErrors.isEmpty()) {
-      throw new GradleException(coverageErrors.join('\n'))
-    }
-  }
-
-  @TaskAction
-  def analyze() {
-    def parser = new XmlSlurper()
-    parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false);
-    // Avoid trying to load the DTD for the XML document, which does not exist.
-    parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
-
-    def coverageReport = parser.parse(coverageReportFile)
-
-    checkGlobalCoverage(coverageReport.counter)
-    checkClassCoverage(coverageReport)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/buildSrc/src/main/groovy/org/apache/aurora/build/CoverageReportCheck.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/aurora/build/CoverageReportCheck.groovy b/buildSrc/src/main/groovy/org/apache/aurora/build/CoverageReportCheck.groovy
new file mode 100644
index 0000000..85210fa
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/aurora/build/CoverageReportCheck.groovy
@@ -0,0 +1,128 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.aurora.build
+
+import org.gradle.api.DefaultTask
+import org.gradle.api.GradleException
+import org.gradle.api.tasks.TaskAction
+
+/**
+ * A task that analyzes the XML coverage report from JaCoCo and fails the build if code coverage
+ * metrics are not met.
+ */
+class CoverageReportCheck extends DefaultTask {
+
+  // The XML coverage report file.
+  def coverageReportFile
+
+  // Minimum ratio of instructions covered, [0, 1.0].
+  def minInstructionCoverage
+
+  // Minimum ratio of branches covered, [0, 1.0].
+  def minBranchCoverage
+
+  // Classes that may be allowed to have zero test coverage.
+  def legacyClassesWithoutCoverage
+
+  // The amount of wiggle room when requiring min coverage be raised.
+  def epsilon = 0.005
+
+  private def computeCoverage(counterNodes, type) {
+    def node = counterNodes.find { it.@type == type }
+    def missed = node.@missed.toInteger()
+    def covered = node.@covered.toInteger()
+    return ((double) covered) / (missed + covered)
+  }
+
+  def checkThresholds(coverage, minCoverage, type) {
+    if (coverage < minCoverage) {
+      return "$type coverage is $coverage, but must be greater than $minCoverage"
+    } else {
+      def floored = Math.floor(coverage * 100) / 100
+      if (floored > (minCoverage + epsilon)) {
+        println("$type coverage of $floored exceeds min instruction coverage of $minCoverage"
+            + " by more than $epsilon, please raise the threshold!")
+      } else {
+        println("$type coverage of $coverage exceeds minimum coverage of $minCoverage.")
+      }
+    }
+  }
+
+  def checkGlobalCoverage(coverageCounts) {
+    def coverageErrors = [
+        [computeCoverage(coverageCounts, 'INSTRUCTION'), minInstructionCoverage, 'Instruction'],
+        [computeCoverage(coverageCounts, 'BRANCH'), minBranchCoverage, 'Branch']
+    ].collect() {
+      return checkThresholds(*it)
+    }.findAll()
+
+    if (!coverageErrors.isEmpty()) {
+      throw new GradleException(coverageErrors.join('\n'))
+    }
+  }
+
+  def checkClassCoverage(coverageReport) {
+    def coverageErrors = coverageReport.package.class.collect { cls ->
+      // javac inserts a synthetic constructor for anonymous classes, and jacoco tends to mark
+      // these as covered in some cases, leading to flaky behavior.  We work around that by
+      // collecting the coverage count for each method in each class, omitting the default
+      // constructor for anonymous classes.  Anonymous classes are identified by their name,
+      // which we expect to be of the form 'Something$1'.  Jacoco names default constructors
+      // '<init>', so we filter based on that.
+      def isAnonymous = { c -> c.@name ==~ /.*\$\d+/ }
+      def methodFilter = isAnonymous(cls) ? { m -> m.@name != '<init>' } : { true }
+
+      def matchedMethods = cls.method.findAll(methodFilter)
+      if (isAnonymous(cls) && matchedMethods.isEmpty()) {
+        // Ignore anonymous classes that only have a constructor. This will avoid tripping for
+        // things like TypeLiteral and Clazz.
+        if (cls.@name in legacyClassesWithoutCoverage) {
+          return 'Please remove ' + cls.@name + ' from the legacyClassesWithoutCoverage list' \
+              + ', this check does not apply for constructor-only anonymous classes.'
+        } else {
+          return null
+        }
+      }
+
+      def covered = matchedMethods.collect { m ->
+        m.counter.find({ c -> c.@type == 'INSTRUCTION' }).@covered.toInteger()}.sum(0)
+
+      if (cls.@name in legacyClassesWithoutCoverage) {
+        if (covered != 0) {
+          return 'Thanks for adding the first test coverage to: ' + cls.@name \
+              + ' please remove it from the legacyClassesWithoutCoverage list'
+        }
+      } else if (covered == 0) {
+        return 'Test coverage missing for ' + cls.@name
+      }
+      return null
+    }.findAll()  // Filter nulls.
+    if (!coverageErrors.isEmpty()) {
+      throw new GradleException(coverageErrors.join('\n'))
+    }
+  }
+
+  @TaskAction
+  def analyze() {
+    def parser = new XmlSlurper()
+    parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false);
+    // Avoid trying to load the DTD for the XML document, which does not exist.
+    parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
+
+    def coverageReport = parser.parse(coverageReportFile)
+
+    checkGlobalCoverage(coverageReport.counter)
+    checkClassCoverage(coverageReport)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/buildSrc/src/main/groovy/org/apache/aurora/build/ThriftEntitiesPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/aurora/build/ThriftEntitiesPlugin.groovy b/buildSrc/src/main/groovy/org/apache/aurora/build/ThriftEntitiesPlugin.groovy
new file mode 100644
index 0000000..31934f5
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/aurora/build/ThriftEntitiesPlugin.groovy
@@ -0,0 +1,113 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.aurora.build
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.file.FileTree
+import org.gradle.api.tasks.compile.JavaCompile
+
+class ThriftEntitiesPlugin implements Plugin<Project>  {
+  @Override
+  void apply(Project project) {
+
+    project.configure(project) {
+      apply plugin: ThriftPlugin
+
+      extensions.create('thriftEntities', ThriftEntitiesPluginExtension, project)
+
+      configurations.create('thriftEntitiesCompile')
+      configurations.thriftEntitiesCompile.extendsFrom(configurations.thriftRuntime)
+
+      afterEvaluate {
+        dependencies {
+          thriftEntitiesCompile "com.google.code.gson:gson:${thriftEntities.gsonRev}"
+          thriftEntitiesCompile "com.google.guava:guava:${thriftEntities.guavaRev}"
+        }
+      }
+      task('generateThriftEntitiesJava') {
+        inputs.files {thriftEntities.inputFiles}
+        outputs.dir {thriftEntities.genJavaDir}
+        doLast {
+          thriftEntities.genJavaDir.exists() || thriftEntities.genJavaDir.mkdirs()
+          thriftEntities.inputFiles.each { File file ->
+            exec {
+              commandLine thriftEntities.python,
+                  thriftEntities.codeGenerator,
+                  file.path,
+                  thriftEntities.genJavaDir,
+                  thriftEntities.genResourcesDir
+            }
+          }
+        }
+      }
+
+      task('classesThriftEntities', type: JavaCompile) {
+        source files(generateThriftEntitiesJava)
+        classpath = configurations.thriftRuntime + configurations.thriftEntitiesCompile
+        destinationDir = file(thriftEntities.genClassesDir)
+        options.warnings = false
+      }
+
+      configurations.create('thriftEntitiesRuntime')
+      configurations.thriftEntitiesRuntime.extendsFrom(configurations.thriftEntitiesCompile)
+      dependencies {
+        thriftEntitiesRuntime files(classesThriftEntities)
+      }
+      configurations.compile.extendsFrom(configurations.thriftEntitiesRuntime)
+      sourceSets.main {
+        output.dir(classesThriftEntities)
+        output.dir(thriftEntities.genResourcesDir, builtBy: 'generateThriftEntitiesJava')
+      }
+    }
+  }
+}
+
+class ThriftEntitiesPluginExtension {
+  def python = 'python2.7'
+  File genClassesDir
+  File genResourcesDir
+  File genJavaDir
+  FileTree inputFiles
+  def codeGenerator
+
+  String gsonRev
+  def getGsonRev() {
+    if (gsonRev == null) {
+      throw new GradleException('thriftEntities.gsonRev is required.')
+    } else {
+      return gsonRev
+    }
+  }
+
+  String guavaRev
+  def getGuavaRev() {
+    if (guavaRev == null) {
+      throw new GradleException('thriftEntities.guavaRev is required.')
+    } else {
+      return guavaRev
+    }
+  }
+
+  ThriftEntitiesPluginExtension(Project project) {
+    genClassesDir = project.file("${project.buildDir}/thriftEntities/classes")
+    genResourcesDir = project.file("${project.buildDir}/thriftEntities/gen-resources")
+    genJavaDir = project.file("${project.buildDir}/thriftEntities/gen-java")
+    inputFiles = project.fileTree("src/main/thrift").matching {
+      include "**/*.thrift"
+    }
+    codeGenerator = "${project.rootDir}/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py"
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/buildSrc/src/main/groovy/org/apache/aurora/build/ThriftPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/aurora/build/ThriftPlugin.groovy b/buildSrc/src/main/groovy/org/apache/aurora/build/ThriftPlugin.groovy
new file mode 100644
index 0000000..e6114cf
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/aurora/build/ThriftPlugin.groovy
@@ -0,0 +1,127 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.aurora.build
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.file.FileTree
+import org.gradle.api.tasks.compile.JavaCompile
+
+class ThriftPlugin implements Plugin<Project> {
+  @Override
+  void apply(Project project) {
+    project.configure(project) {
+      apply plugin: 'java'
+
+      extensions.create('thrift', ThriftPluginExtension, project)
+
+      configurations.create('thriftCompile')
+      afterEvaluate {
+        dependencies {
+          thriftCompile "org.apache.thrift:libthrift:${thrift.version}"
+        }
+      }
+
+      task('generateThriftJava') {
+        inputs.files {thrift.inputFiles}
+        outputs.dir {thrift.genJavaDir}
+        doLast {
+          thrift.genJavaDir.exists() || thrift.genJavaDir.mkdirs()
+          thrift.inputFiles.each { File file ->
+            exec {
+              commandLine thrift.wrapperPath, thrift.version,
+                  '--gen', 'java:hashcode,private-members',
+                  '-out', thrift.genJavaDir.path,
+                  file.path
+            }
+          }
+        }
+      }
+
+      task('generateThriftResources') {
+        inputs.files {thrift.inputFiles}
+        outputs.dir {thrift.genResourcesDir}
+        doLast {
+          def dest = file("${thrift.genResourcesDir}/${thrift.resourcePrefix}")
+          dest.exists() || dest.mkdirs()
+          thrift.inputFiles.each { File file ->
+            exec {
+              commandLine thrift.wrapperPath, thrift.version,
+                  '--gen', 'js:jquery',
+                  '-out', dest.path, file.path
+            }
+          }
+        }
+      }
+
+      task('classesThrift', type: JavaCompile) {
+        source files(generateThriftJava)
+        classpath = configurations.thriftCompile
+        destinationDir = file(thrift.genClassesDir)
+        options.warnings = false
+      }
+
+      configurations.create('thriftRuntime')
+      configurations.thriftRuntime.extendsFrom(configurations.thriftCompile)
+      configurations.compile.extendsFrom(configurations.thriftRuntime)
+      dependencies {
+        thriftRuntime files(classesThrift)
+      }
+
+      sourceSets.main {
+        output.dir(classesThrift)
+        output.dir(generateThriftResources)
+      }
+    }
+  }
+}
+
+class ThriftPluginExtension {
+  def wrapperPath
+  File genResourcesDir
+  File genJavaDir
+  File genClassesDir
+  FileTree inputFiles
+
+  String version
+  String getVersion() {
+    if (version == null) {
+      throw new GradleException('thrift.version is required.')
+    } else {
+      return version
+    }
+  }
+
+  String resourcePrefix
+
+  /* Classpath prefix for generated resources. */
+  String getResourcesPrefix() {
+    if (resourcePrefix == null) {
+      throw new GradleException('thrift.resourcePrefix is required.')
+    } else {
+      return resourcePrefix
+    }
+  }
+
+  ThriftPluginExtension(Project project) {
+    wrapperPath = "${project.rootDir}/build-support/thrift/thriftw"
+    genResourcesDir = project.file("${project.buildDir}/thrift/gen-resources")
+    genJavaDir = project.file("${project.buildDir}/thrift/gen-java")
+    genClassesDir = project.file("${project.buildDir}/thrift/classes")
+    inputFiles = project.fileTree("src/main/thrift").matching {
+      include "**/*.thrift"
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/gradle/wrapper/gradle-wrapper.properties
----------------------------------------------------------------------
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index b043002..9cfd8b6 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Nov 13 09:01:57 PST 2014
+#Thu Nov 13 11:02:51 PST 2014
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 3e9cbfe..6180227 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1,15 @@
-include 'buildSrc'
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+rootProject.name = 'aurora'
+include 'api', 'buildSrc'

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java b/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
index 4b92815..022b9f4 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
@@ -110,6 +110,17 @@ public class JettyServerModule extends AbstractModule {
       PROPERTY_CONTAINER_REQUEST_FILTERS, GZIPContentEncodingFilter.class.getName(),
       PROPERTY_CONTAINER_RESPONSE_FILTERS, GZIPContentEncodingFilter.class.getName());
 
+  private static final String ENTITIES_HELP_ROOT = Resource
+      .newClassPathResource("org/apache/aurora/scheduler/storage/entities/help")
+      .toString();
+  private static final String API_CLIENT_ROOT = Resource
+      .newClassPathResource("org/apache/aurora/scheduler/gen/client")
+      .toString();
+  private static final String STATIC_ASSETS_ROOT = Resource
+      .newClassPathResource("scheduler/assets/index.html")
+      .toString()
+      .replace("assets/index.html", "");
+
   @Override
   protected void configure() {
     bind(Runnable.class)
@@ -162,7 +173,6 @@ public class JettyServerModule extends AbstractModule {
     private static final Map<String, String> REGEX_REWRITE_RULES =
         ImmutableMap.<String, String>builder()
             .put("/(?:index.html)?", "/assets/index.html")
-            .put("/apibeta/help/(.*)?", "/assets/org/apache/aurora/scheduler/storage/entities/$1")
             .put("/graphview(?:/index.html)?", "/assets/graphview/graphview.html")
             .put("/graphview/(.*)", "/assets/graphview/$1")
             .put("/(?:scheduler|updates)(?:/.*)?", "/assets/scheduler/index.html")
@@ -186,6 +196,16 @@ public class JettyServerModule extends AbstractModule {
       return rewrites;
     }
 
+    @Singleton
+    static class ApiHelpResourceServlet extends DefaultServlet {
+      // Subclass to allow extra instance of DefaultServlet.
+    }
+
+    @Singleton
+    static class ApiClientServlet extends DefaultServlet {
+      // Subclass to allow extra instance of DefaultServlet.
+    }
+
     @Override
     public LocalService launch() throws LaunchException {
       // N.B. we explicitly disable the resource cache here due to a bug serving content out of the
@@ -249,9 +269,23 @@ public class JettyServerModule extends AbstractModule {
               bind(DefaultServlet.class).in(Singleton.class);
               serve("/assets*")
                   .with(DefaultServlet.class, ImmutableMap.of(
-                      "resourceBase", Resource.newClassPathResource("scheduler").toString(),
+                      "resourceBase", STATIC_ASSETS_ROOT,
                       "dirAllowed", "false"));
 
+              serve("/apihelp/*")
+                  .with(ApiHelpResourceServlet.class, ImmutableMap.<String, String>builder()
+                      .put("resourceBase", ENTITIES_HELP_ROOT)
+                      .put("pathInfoOnly", "true")
+                      .put("dirAllowed", "false")
+                      .build());
+
+              serve("/apiclient/*")
+                  .with(ApiClientServlet.class, ImmutableMap.<String, String>builder()
+                      .put("resourceBase", API_CLIENT_ROOT)
+                      .put("pathInfoOnly", "true")
+                      .put("dirAllowed", "false")
+                      .build());
+
               bind(GuiceContainer.class).in(Singleton.class);
               registerJerseyEndpoint("/apibeta", ApiBeta.class);
               registerJerseyEndpoint("/cron", Cron.class);

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java b/src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java
index c072010..53ea03b 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java
@@ -168,6 +168,6 @@ public class ApiBeta {
   @GET
   @Produces(MediaType.TEXT_HTML)
   public Response getIndex() {
-    return Response.seeOther(URI.create("/apibeta/help/index.html")).build();
+    return Response.seeOther(URI.create("/apihelp/index.html")).build();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/admin/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/admin/BUILD b/src/main/python/apache/aurora/admin/BUILD
index 9441e12..f874264 100644
--- a/src/main/python/apache/aurora/admin/BUILD
+++ b/src/main/python/apache/aurora/admin/BUILD
@@ -20,7 +20,7 @@ python_library(
     '3rdparty/python:twitter.common.log',
     '3rdparty/python:twitter.common.quantity',
     'src/main/python/apache/aurora/client:api',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/client/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/BUILD b/src/main/python/apache/aurora/client/BUILD
index 48566d9..2a66825 100644
--- a/src/main/python/apache/aurora/client/BUILD
+++ b/src/main/python/apache/aurora/client/BUILD
@@ -28,7 +28,7 @@ python_library(
   dependencies = [
     '3rdparty/python:twitter.common.app',
     '3rdparty/python:twitter.common.log',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -50,7 +50,7 @@ python_library(
     '3rdparty/python:twitter.common.app',
     '3rdparty/python:twitter.common.log',
     'src/main/python/apache/aurora/config',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/client/api/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/BUILD b/src/main/python/apache/aurora/client/api/BUILD
index 6d2a1bf..8b0da67 100644
--- a/src/main/python/apache/aurora/client/api/BUILD
+++ b/src/main/python/apache/aurora/client/api/BUILD
@@ -23,7 +23,7 @@ python_library(
     '3rdparty/python:twitter.common.lang',
     '3rdparty/python:twitter.common.log',
     'src/main/python/apache/aurora/common',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -36,7 +36,7 @@ python_library(
     'src/main/python/apache/thermos/config:schema',
     'src/main/python/apache/aurora/common:cluster',
     'src/main/python/apache/aurora/config:schema',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -58,7 +58,7 @@ python_library(
     ':task_util',
     '3rdparty/python:twitter.common.log',
     '3rdparty/python:twitter.common.quantity',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -69,7 +69,7 @@ python_library(
     ':instance_watcher',
     ':updater_util',
     '3rdparty/python:twitter.common.log',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -84,7 +84,7 @@ python_library(
     'src/main/python/apache/aurora/common/auth',
     'src/main/python/apache/aurora/common:cluster',
     'src/main/python/apache/aurora/common:transport',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -115,7 +115,7 @@ python_library(
     ':scheduler_mux',
     '3rdparty/python:twitter.common.log',
     'src/main/python/apache/aurora/client:base',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -129,7 +129,7 @@ python_library(
     '3rdparty/python:twitter.common.lang',
     '3rdparty/python:twitter.common.log',
     'src/main/python/apache/aurora/common:http_signaler',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -139,7 +139,7 @@ python_library(
   dependencies = [
     ':scheduler_client',
     '3rdparty/python:twitter.common.log',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -151,7 +151,7 @@ python_library(
     '3rdparty/python:twitter.common.log',
     'src/main/python/apache/aurora/client:base',
     'src/main/python/apache/aurora/common',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -166,7 +166,7 @@ python_library(
     ':quota_check',
     '3rdparty/python:twitter.common.log',
     'src/main/python/apache/aurora/client:base',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/client/cli/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/BUILD b/src/main/python/apache/aurora/client/cli/BUILD
index e6627a8..8d34bf7 100644
--- a/src/main/python/apache/aurora/client/cli/BUILD
+++ b/src/main/python/apache/aurora/client/cli/BUILD
@@ -76,6 +76,6 @@ python_library(
     'src/main/python/apache/aurora/client:factory',
     'src/main/python/apache/aurora/client:options',
     'src/main/python/apache/aurora/common',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ],
 )

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/client/commands/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/commands/BUILD b/src/main/python/apache/aurora/client/commands/BUILD
index d146015..f256483 100644
--- a/src/main/python/apache/aurora/client/commands/BUILD
+++ b/src/main/python/apache/aurora/client/commands/BUILD
@@ -33,7 +33,7 @@ python_library(
     'src/main/python/apache/aurora/client/api',
     'src/main/python/apache/aurora/client:base',
     'src/main/python/apache/aurora/common:clusters',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -67,7 +67,7 @@ python_library(
     'src/main/python/apache/aurora/client:factory',
     'src/main/python/apache/aurora/client:options',
     'src/main/python/apache/aurora/common',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/client/hooks/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/hooks/BUILD b/src/main/python/apache/aurora/client/hooks/BUILD
index f46cf65..49d73df 100644
--- a/src/main/python/apache/aurora/client/hooks/BUILD
+++ b/src/main/python/apache/aurora/client/hooks/BUILD
@@ -19,6 +19,6 @@ python_library(
     '3rdparty/python:twitter.common.log',
     'src/main/python/apache/aurora/client:api',
     'src/main/python/apache/aurora/common:aurora_job_key',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/common/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/common/BUILD b/src/main/python/apache/aurora/common/BUILD
index 02ec17c..2149688 100644
--- a/src/main/python/apache/aurora/common/BUILD
+++ b/src/main/python/apache/aurora/common/BUILD
@@ -19,7 +19,7 @@ python_library(
   sources = ['aurora_job_key.py'],
   dependencies = [
     '3rdparty/python:twitter.common.lang',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )
 
@@ -88,7 +88,7 @@ python_library(
     'src/main/python/apache/aurora/common/auth',
 
     # covering dependency on gen.*
-    'src/main/thrift/org/apache/aurora/gen:py-thrift-packaged',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift-packaged',
   ],
   provides = setup_py(
     name = 'apache.aurora.common',

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/common/auth/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/common/auth/BUILD b/src/main/python/apache/aurora/common/auth/BUILD
index c26d117..9664846 100644
--- a/src/main/python/apache/aurora/common/auth/BUILD
+++ b/src/main/python/apache/aurora/common/auth/BUILD
@@ -18,6 +18,6 @@ python_library(
   dependencies = [
     '3rdparty/python:twitter.common.lang',
     '3rdparty/python:twitter.common.log',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/config/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/config/BUILD b/src/main/python/apache/aurora/config/BUILD
index fa40ebd..0a3a93f 100644
--- a/src/main/python/apache/aurora/config/BUILD
+++ b/src/main/python/apache/aurora/config/BUILD
@@ -35,7 +35,7 @@ python_library(
     '3rdparty/python:twitter.common.lang',
     'src/main/python/apache/aurora/common',
     'src/main/python/apache/aurora/config/schema',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ],
 
 )

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/config/schema/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/config/schema/BUILD b/src/main/python/apache/aurora/config/schema/BUILD
index 157c141..171f42a 100644
--- a/src/main/python/apache/aurora/config/schema/BUILD
+++ b/src/main/python/apache/aurora/config/schema/BUILD
@@ -18,6 +18,6 @@ python_library(
   dependencies = [
     '3rdparty/python:pystachio',
     'src/main/python/apache/thermos/config:schema',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/executor/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/executor/BUILD b/src/main/python/apache/aurora/executor/BUILD
index ca4193d..3a2d4f8 100644
--- a/src/main/python/apache/aurora/executor/BUILD
+++ b/src/main/python/apache/aurora/executor/BUILD
@@ -133,8 +133,8 @@ python_library(
     'src/main/python/apache/thermos/monitoring:garbage',
     'src/main/python/apache/aurora/config:schema',
     'src/main/python/apache/aurora/executor/common:sandbox',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ]
 )
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/executor/common/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/executor/common/BUILD b/src/main/python/apache/aurora/executor/common/BUILD
index d33e14b..142ec0d 100644
--- a/src/main/python/apache/aurora/executor/common/BUILD
+++ b/src/main/python/apache/aurora/executor/common/BUILD
@@ -96,6 +96,6 @@ python_library(
     '3rdparty/python:twitter.common.log',
     'src/main/python/apache/aurora/config',
     'src/main/python/apache/aurora/config/schema',
-    'src/main/thrift/org/apache/aurora/gen:py-thrift',
+    'api/src/main/thrift/org/apache/aurora/gen:py-thrift',
   ]
 )

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py b/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
index d6bb5a1..ca2581c 100644
--- a/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
+++ b/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
@@ -489,12 +489,12 @@ def parse_structs(thrift_defs):
   for s in re.finditer(STRUCT_RE, thrift_defs, flags=re.MULTILINE):
     if s.group('kind') == 'enum':
       struct = EnumType(s.group('name'),
-                        namespaces['java'],
+                        namespaces.get('java', ''),
                         parse_values(s.group('body')),
                         s.group('doc'))
     else:
       struct = StructType(s.group('name'),
-                          namespaces['java'],
+                          namespaces.get('java', ''),
                           s.group('kind'),
                           parse_fields(s.group('body')),
                           s.group('doc'))
@@ -633,6 +633,10 @@ if __name__ == '__main__':
   with open(thrift_file) as f:
     # Load all structs found in the thrift file.
     file_contents = f.read()
+    services = parse_services(file_contents)
+    if not services:
+      log('Skipping doc generation for %s since there are no services.' % thrift_file)
+      sys.exit(0)
     structs = parse_structs(file_contents)
 
     package_dir = os.path.join(code_output_dir, PACKAGE_NAME.replace('.', os.path.sep))
@@ -648,8 +652,7 @@ if __name__ == '__main__':
         code = generate_java(struct)
         code.dump(f)
 
-    services = parse_services(file_contents)
-    resource_dir = os.path.join(resource_output_dir, PACKAGE_NAME.replace('.', os.path.sep))
+    resource_dir = os.path.join(resource_output_dir, PACKAGE_NAME.replace('.', os.path.sep), 'help')
     if not os.path.isdir(resource_dir):
       os.makedirs(resource_dir)
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/thermos/bin/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/bin/BUILD b/src/main/python/apache/thermos/bin/BUILD
index 34e2b3f..a1d6e52 100644
--- a/src/main/python/apache/thermos/bin/BUILD
+++ b/src/main/python/apache/thermos/bin/BUILD
@@ -19,7 +19,7 @@ python_binary(
     '3rdparty/python:twitter.common.app',
     '3rdparty/python:twitter.common.recordio',
     'src/main/python/apache/thermos/common',
-    'src/main/thrift/org/apache/thermos:py-thrift'
+    'api/src/main/thrift/org/apache/thermos:py-thrift'
   ]
 )
 
@@ -33,6 +33,6 @@ python_binary(
     'src/main/python/apache/thermos/config:schema',
     'src/main/python/apache/thermos/core',
     'src/main/python/apache/thermos/monitoring',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ],
 )

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/thermos/common/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/common/BUILD b/src/main/python/apache/thermos/common/BUILD
index 918800b..24d7b6e 100644
--- a/src/main/python/apache/thermos/common/BUILD
+++ b/src/main/python/apache/thermos/common/BUILD
@@ -20,7 +20,7 @@ python_library(
   dependencies = [
     '3rdparty/python:twitter.common.log',
     '3rdparty/python:twitter.common.recordio',
-    'src/main/thrift/org/apache/thermos:py-thrift'
+    'api/src/main/thrift/org/apache/thermos:py-thrift'
   ]
 )
 
@@ -39,7 +39,7 @@ python_library(
   sources = ['options.py'],
   dependencies = [
     '3rdparty/python:pystachio',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ]
 )
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/thermos/core/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/core/BUILD b/src/main/python/apache/thermos/core/BUILD
index f362acd..efb68e8 100644
--- a/src/main/python/apache/thermos/core/BUILD
+++ b/src/main/python/apache/thermos/core/BUILD
@@ -25,7 +25,7 @@ python_library(
     '3rdparty/python:twitter.common.recordio',
     'src/main/python/apache/thermos/common:ckpt',
     'src/main/python/apache/thermos/common:path',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ]
 )
 
@@ -37,7 +37,7 @@ python_library(
     '3rdparty/python:twitter.common.recordio',
     'src/main/python/apache/thermos/common:ckpt',
     'src/main/python/apache/thermos/common:path',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ]
 )
 
@@ -47,7 +47,7 @@ python_library(
   dependencies = [
     '3rdparty/python:twitter.common.log',
     '3rdparty/python:twitter.common.recordio',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ]
 )
 
@@ -60,7 +60,7 @@ python_library(
     '3rdparty/python:twitter.common.log',
     '3rdparty/python:twitter.common.quantity',
     '3rdparty/python:twitter.common.recordio',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ]
 )
 
@@ -80,7 +80,7 @@ python_library(
     'src/main/python/apache/thermos/common:path',
     'src/main/python/apache/thermos/common:planner',
     'src/main/python/apache/thermos/config:schema',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ]
 )
 
@@ -93,7 +93,7 @@ python_library(
     # covering libs
     'src/main/python/apache/thermos/common',
     'src/main/python/apache/thermos/config',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ],
   provides = setup_py(
     name = 'apache.thermos.core',

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/thermos/monitoring/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/monitoring/BUILD b/src/main/python/apache/thermos/monitoring/BUILD
index 0dad47e..33259c8 100644
--- a/src/main/python/apache/thermos/monitoring/BUILD
+++ b/src/main/python/apache/thermos/monitoring/BUILD
@@ -42,7 +42,7 @@ python_library(
     '3rdparty/python:twitter.common.log',
     '3rdparty/python:twitter.common.recordio',
     'src/main/python/apache/thermos/common:ckpt',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ]
 )
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/thermos/observer/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/observer/BUILD b/src/main/python/apache/thermos/observer/BUILD
index b07db90..ee65f3a 100644
--- a/src/main/python/apache/thermos/observer/BUILD
+++ b/src/main/python/apache/thermos/observer/BUILD
@@ -40,7 +40,7 @@ python_library(
     'src/main/python/apache/thermos/monitoring:monitor',
     'src/main/python/apache/thermos/monitoring:process',
     'src/main/python/apache/thermos/monitoring:resource',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ]
 )
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/python/apache/thermos/testing/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/testing/BUILD b/src/main/python/apache/thermos/testing/BUILD
index b96c166..8b5f6dc 100644
--- a/src/main/python/apache/thermos/testing/BUILD
+++ b/src/main/python/apache/thermos/testing/BUILD
@@ -23,6 +23,6 @@ python_library(
     'src/main/python/apache/thermos/common:path',
     'src/main/python/apache/thermos/config',
     'src/main/python/apache/thermos/core',
-    'src/main/thrift/org/apache/thermos:py-thrift',
+    'api/src/main/thrift/org/apache/thermos:py-thrift',
   ]
 )

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/resources/scheduler/assets/scheduler/index.html
----------------------------------------------------------------------
diff --git a/src/main/resources/scheduler/assets/scheduler/index.html b/src/main/resources/scheduler/assets/scheduler/index.html
index f4ca071..383ca43 100644
--- a/src/main/resources/scheduler/assets/scheduler/index.html
+++ b/src/main/resources/scheduler/assets/scheduler/index.html
@@ -41,8 +41,8 @@
 
 <!-- Thrift -->
 <script src='/assets/js/thrift.js'></script>
-<script src='/assets/js/api_types.js'></script>
-<script src='/assets/js/ReadOnlyScheduler.js'></script>
+<script src='/apiclient/api_types.js'></script>
+<script src='/apiclient/ReadOnlyScheduler.js'></script>
 
 <!-- Angular -->
 <script src='/assets/bower_components/angular/angular.js'></script>

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/thrift/org/apache/aurora/gen/BUILD
----------------------------------------------------------------------
diff --git a/src/main/thrift/org/apache/aurora/gen/BUILD b/src/main/thrift/org/apache/aurora/gen/BUILD
deleted file mode 100644
index fe3f83b..0000000
--- a/src/main/thrift/org/apache/aurora/gen/BUILD
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-import os
-
-TEST_DATA = globs('*test.thrift')
-
-python_thrift_library(
-  name = 'py-thrift',
-  sources = [
-    'api.thrift',
-    'internal_rpc.thrift',
-  ],
-)
-
-python_thrift_library(
-  name = 'py-thrift-test',
-  sources = TEST_DATA,
-)
-
-python_thrift_library(
-  name = 'py-thrift-storage',
-  sources = ['storage.thrift'],
-  dependencies = [
-    ':py-thrift',
-  ],
-)
-
-python_library(
-  name = 'py-thrift-packaged',
-  dependencies = [
-    ':py-thrift',
-    ':py-thrift-test',
-    ':py-thrift-storage',
-  ],
-  provides = setup_py(
-    name = 'apache.gen.aurora',
-    version = open(os.path.join(get_buildroot(), '.auroraversion')).read().strip().upper(),
-    description = 'Autogenerated Aurora thrift schemas.',
-  )
-)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/thrift/org/apache/aurora/gen/api.thrift
----------------------------------------------------------------------
diff --git a/src/main/thrift/org/apache/aurora/gen/api.thrift b/src/main/thrift/org/apache/aurora/gen/api.thrift
deleted file mode 100644
index b91fca9..0000000
--- a/src/main/thrift/org/apache/aurora/gen/api.thrift
+++ /dev/null
@@ -1,1117 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace java org.apache.aurora.gen
-namespace py gen.apache.aurora.api
-
-// Thrift interface definition for the aurora scheduler.
-
-/*
- * TODO(wfarner): It would be nice if we could put some HTML tags here, regex doesn't handle it though.
- * The result of an API operation.  A result may only be specified when this is OK.
- */
-enum ResponseCode {
-  INVALID_REQUEST = 0,
-  OK              = 1,
-  ERROR           = 2,
-  WARNING         = 3,
-  AUTH_FAILED     = 4,
-  /** Raised when a Lock-protected operation failed due to lock validation. */
-  LOCK_ERROR      = 5,
-  /** Raised when a scheduler is transiently unavailable and later retry is recommended. */
-  ERROR_TRANSIENT = 6
-}
-
-const i32 THRIFT_API_VERSION = 3
-
-struct APIVersion {
-  1: required i32 major
-}
-
-// Scheduler Thrift API Version. Increment this when breaking backwards compatibility.
-const APIVersion CURRENT_API_VERSION = {'major': THRIFT_API_VERSION}
-
-// Aurora executor framework name.
-const string AURORA_EXECUTOR_NAME = 'AuroraExecutor'
-
-// TODO(maxim): Remove in 0.7.0. (AURORA-749)
-struct Identity {
-  1: string role
-  2: string user
-}
-
-struct SessionKey {
-  /**
-   * The name of the authentication mechanism, which instructs the server how to interpret the data
-   * field.
-   */
-  4: optional string mechanism
-  /** A blob of data that the server may use for authentication. */
-  5: optional binary data
-}
-
-struct ResourceAggregate {
-  /** Number of CPU cores allotted. */
-  1: double numCpus
-  /** Megabytes of RAM allotted. */
-  2: i64 ramMb
-  /** Megabytes of disk space allotted. */
-  3: i64 diskMb
-}
-
-/** A single host attribute. */
-struct Attribute {
-  1: string name
-  2: set<string> values
-}
-
-enum MaintenanceMode {
-  NONE      = 1,
-  SCHEDULED = 2,
-  DRAINING  = 3,
-  DRAINED   = 4
-}
-
-/** The attributes assigned to a host. */
-struct HostAttributes {
-  1: string          host
-  2: set<Attribute>  attributes
-  3: optional MaintenanceMode mode
-  4: optional string slaveId
-}
-
-/**
- * A constraint that specifies an explicit set of values, at least one of which must be present
- * on a host for a task to be scheduled there.
- */
-struct ValueConstraint {
-  /** If true, treat this as a 'not' - to avoid specific values. */
-  1: bool negated
-  2: set<string> values
-}
-
-/**
- * A constraint the specifies the maximum number of active tasks on a host with a matching
- * attribute that may be scheduled simultaneously.
- */
-struct LimitConstraint {
-  1: i32 limit
-}
-
-/** Types of constraints that may be applied to a task. */
-union TaskConstraint {
-  1: ValueConstraint value
-  2: LimitConstraint limit
-}
-
-/** A constraint that defines whether a task may be scheduled on a host. */
-struct Constraint {
-  /** Mesos slave attribute that the constraint is matched against. */
-  1: string name
-  2: TaskConstraint constraint
-}
-
-struct Package {
-  1: string role
-  2: string name
-  3: i32 version
-}
-
-/** Arbitrary key-value metadata to be included into TaskConfig. */
-struct Metadata {
-  1: string key
-  2: string value
-}
-
-/** A unique identifier for a Job. */
-struct JobKey {
-  /** User role (Unix service account), for example "mesos" */
-  1: string role
-  /** Environment, for example "devel" */
-  2: string environment
-  /** Name, for example "labrat" */
-  3: string name
-}
-
-/** A unique lock key. */
-union LockKey {
-  1: JobKey job
-}
-
-/** A generic lock struct to facilitate context specific resource/operation serialization. */
-struct Lock {
-  /** ID of the lock - unique per storage */
-  1: LockKey key
-  /** UUID - facilitating soft lock authorization */
-  2: string token
-  /** Lock creator */
-  3: string user
-  /** Lock creation timestamp in milliseconds */
-  4: i64 timestampMs
-  /** Optional message to record with the lock */
-  5: optional string message
-}
-
-/** Defines the required lock validation level. */
-enum LockValidation {
-  /** The lock must be valid in order to be released. */
-  CHECKED   = 0
-  /** The lock will be released without validation (aka "force release"). */
-  UNCHECKED = 1
-}
-
-/** A unique identifier for the active task within a job. */
-struct InstanceKey {
-  /** Key identifying the job. */
-  1: JobKey jobKey
-  /** Unique instance ID for the active task in a job. */
-  2: i32 instanceId
-}
-
-struct ExecutorConfig {
-  /** Name identifying the Executor. */
-  1: string name
-  /** Executor configuration data. */
-  2: string data
-}
-
-/** Description of the tasks contained within a job. */
-struct TaskConfig {
- /** Job task belongs to. */
- 28: JobKey job
- // TODO(maxim): Remove in 0.7.0. (AURORA-749)
- /** contains the role component of JobKey */
- 17: Identity owner
- // TODO(maxim): Remove in 0.7.0. (AURORA-749)
- /** contains the environment component of JobKey */
- 26: string environment
- // TODO(maxim): Remove in 0.7.0. (AURORA-749)
- /** contains the name component of JobKey */
-  3: string jobName
-  7: bool isService
-  8: double numCpus
-  9: i64 ramMb
- 10: i64 diskMb
- 11: i32 priority
- 13: i32 maxTaskFailures
- /** Whether this is a production task, which can preempt. */
- 18: optional bool production
-
- 20: set<Constraint> constraints
- /** a list of named ports this task requests */
- 21: set<string> requestedPorts
-
- /**
-  * Custom links to include when displaying this task on the scheduler dashboard. Keys are anchor
-  * text, values are URLs. Wildcards are supported for dynamic link crafting based on host, ports,
-  * instance, etc.
-  */
- 22: optional map<string, string> taskLinks
- 23: optional string contactEmail
- /** Executor configuration */
- 25: optional ExecutorConfig executorConfig
- /** Used to display additional details in the UI. */
- 27: optional set<Metadata> metadata
-}
-
-/** Defines the policy for launching a new cron job when one is already running. */
-enum CronCollisionPolicy {
-  /** Kills the existing job with the colliding name, and runs the new cron job. */
-  KILL_EXISTING = 0,
-  /** Cancels execution of the new job, leaving the running job in tact. */
-  CANCEL_NEW    = 1,
-  /**
-   * DEPRECATED. For existing jobs, treated the same as CANCEL_NEW.
-   * createJob will reject jobs with this policy.
-   */
-  RUN_OVERLAP   = 2
-}
-
-/**
- * Description of an Aurora job. One task will be scheduled for each instance within the job.
- */
-struct JobConfiguration {
-  /**
-   * Key for this job. If not specified name, owner.role, and a reasonable default environment are
-   * used to construct it server-side.
-   */
-  9: JobKey key
-  // TODO(maxim): Remove in 0.7.0. (AURORA-749)
-  /** Owner of this job. */
-  7: Identity owner
-  /**
-   * If present, the job will be handled as a cron job with this crontab-syntax schedule.
-   */
-  4: string cronSchedule
-  /** Collision policy to use when handling overlapping cron runs.  Default is KILL_EXISTING. */
-  5: CronCollisionPolicy cronCollisionPolicy
-  /** Task configuration for this job. */
-  6: TaskConfig taskConfig
-  /**
-   * The number of instances in the job. Generated instance IDs for tasks will be in the range
-   * [0, instances).
-   */
-  8: i32 instanceCount
-}
-
-struct JobStats {
-  /** Number of tasks in active state for this job. */
-  1: i32 activeTaskCount
-  /** Number of tasks in finished state for this job. */
-  2: i32 finishedTaskCount
-  /** Number of failed tasks for this job. */
-  3: i32 failedTaskCount
-  /** Number of tasks in pending state for this job. */
-  4: i32 pendingTaskCount
-}
-
-struct JobSummary {
-  1: JobConfiguration job
-  2: JobStats stats
-  /** Timestamp of next cron run in ms since epoch, for a cron job */
-  3: optional i64 nextCronRunMs
-}
-
-/** A request to add the following instances to an existing job. Used by addInstances. */
-struct AddInstancesConfig {
-  1: JobKey key
-  2: TaskConfig taskConfig
-  3: set<i32> instanceIds
-}
-
-/** Closed range of integers. */
-struct Range {
-  1: i32 first
-  2: i32 last
-}
-
-struct ConfigGroup {
-  1: TaskConfig config
-  2: set<i32> instanceIds   // TODO(maxim): change it to use list<Range> instead.
-}
-
-struct ConfigSummary {
-  1: JobKey key
-  2: set<ConfigGroup> groups
-}
-
-struct PopulateJobResult {
-  // TODO(maxim): Remove populated field in 0.7.0. (AURORA-691)
-  1: set<TaskConfig> populatedDEPRECATED
-  2: TaskConfig taskConfig
-}
-
-struct GetQuotaResult {
-  /** Total allocated resource quota. */
-  1: ResourceAggregate quota
-  /** Resources consumed by production jobs. */
-  2: optional ResourceAggregate prodConsumption
-  /** Resources consumed by non-production jobs. */
-  3: optional ResourceAggregate nonProdConsumption
-}
-
-/** Wraps return results for the acquireLock API. */
-struct AcquireLockResult {
-  /** Acquired Lock instance. */
-  1: Lock lock
-}
-
-/** States that a task may be in. */
-enum ScheduleStatus {
-  // TODO(maxim): This state does not add much value. Consider dropping it completely.
-  /* Initial state for a task.  A task will remain in this state until it has been persisted. */
-  INIT             = 11,
-  /** The task will be rescheduled, but is being throttled for restarting too frequently. */
-  THROTTLED        = 16,
-  /** Task is awaiting assignment to a slave. */
-  PENDING          = 0,
-  /** Task has been assigned to a slave. */
-  ASSIGNED         = 9,
-  /** Slave has acknowledged receipt of task and is bootstrapping the task. */
-  STARTING         = 1,
-  /** The task is running on the slave. */
-  RUNNING          = 2,
-  /** The task terminated with an exit code of zero. */
-  FINISHED         = 3,
-  /** The task is being preempted by another task. */
-  PREEMPTING       = 13,
-  /** The task is being restarted in response to a user request. */
-  RESTARTING       = 12,
-  /** The task is being restarted in response to a host maintenance request. */
-  DRAINING         = 17,
-  /** The task terminated with a non-zero exit code. */
-  FAILED           = 4,
-  /** Execution of the task was terminated by the system. */
-  KILLED           = 5,
-  /** The task is being forcibly killed. */
-  KILLING          = 6,
-  /** A fault in the task environment has caused the system to believe the task no longer exists.
-   * This can happen, for example, when a slave process disappears.
-   */
-  LOST             = 7,
-  // TODO(maxim): Remove SANDBOX_DELETED in 0.7.0. (AURORA-832)
-  /** The task sandbox has been deleted by the executor. */
-  SANDBOX_DELETED  = 10
-}
-
-// States that a task may be in while still considered active.
-const set<ScheduleStatus> ACTIVE_STATES = [ScheduleStatus.ASSIGNED,
-                                           ScheduleStatus.DRAINING,
-                                           ScheduleStatus.KILLING,
-                                           ScheduleStatus.PENDING,
-                                           ScheduleStatus.PREEMPTING,
-                                           ScheduleStatus.RESTARTING
-                                           ScheduleStatus.RUNNING,
-                                           ScheduleStatus.STARTING,
-                                           ScheduleStatus.THROTTLED]
-
-// States that a task may be in while associated with a slave machine and non-terminal.
-const set<ScheduleStatus> SLAVE_ASSIGNED_STATES = [ScheduleStatus.ASSIGNED,
-                                                   ScheduleStatus.DRAINING,
-                                                   ScheduleStatus.KILLING,
-                                                   ScheduleStatus.PREEMPTING,
-                                                   ScheduleStatus.RESTARTING,
-                                                   ScheduleStatus.RUNNING,
-                                                   ScheduleStatus.STARTING]
-
-// States that a task may be in while in an active sandbox.
-const set<ScheduleStatus> LIVE_STATES = [ScheduleStatus.KILLING,
-                                         ScheduleStatus.PREEMPTING,
-                                         ScheduleStatus.RESTARTING,
-                                         ScheduleStatus.DRAINING,
-                                         ScheduleStatus.RUNNING]
-
-// States a completed task may be in.
-const set<ScheduleStatus> TERMINAL_STATES = [ScheduleStatus.FAILED,
-                                             ScheduleStatus.FINISHED,
-                                             ScheduleStatus.KILLED,
-                                             ScheduleStatus.LOST,
-                                             ScheduleStatus.SANDBOX_DELETED]
-
-// Regular expressions for matching valid identifiers for job path components. All expressions
-// below should accept and reject the same set of inputs.
-const string GOOD_IDENTIFIER_PATTERN = "^[\\w\\-\\.]+$"
-// JVM: Use with java.util.regex.Pattern#compile
-const string GOOD_IDENTIFIER_PATTERN_JVM = GOOD_IDENTIFIER_PATTERN
-// Python: Use with re.compile
-const string GOOD_IDENTIFIER_PATTERN_PYTHON = GOOD_IDENTIFIER_PATTERN
-
-/** Event marking a state transition within a task's lifecycle. */
-struct TaskEvent {
-  /** Epoch timestamp in milliseconds. */
-  1: i64 timestamp
-  /** New status of the task. */
-  2: ScheduleStatus status
-  /** Audit message that explains why a transition occurred. */
-  3: optional string message
-  /** Hostname of the scheduler machine that performed the event. */
-  4: optional string scheduler
-}
-
-/** A task assignment that is provided to an executor. */
-struct AssignedTask {
-  /** The mesos task ID for this task.  Guaranteed to be globally unique */
-  1: string taskId
-
-  /**
-   * The mesos slave ID that this task has been assigned to.
-   * This will not be populated for a PENDING task.
-   */
-  2: string slaveId
-
-  /**
-   * The name of the machine that this task has been assigned to.
-   * This will not be populated for a PENDING task.
-   */
-  3: string slaveHost
-
-  /** Information about how to run this task. */
-  4: TaskConfig task
-  /** Ports reserved on the machine while this task is running. */
-  5: map<string, i32> assignedPorts
-
-  /**
-   * The instance ID assigned to this task. Instance IDs must be unique and contiguous within a
-   * job, and will be in the range [0, N-1] (inclusive) for a job that has N instances.
-   */
-  6: i32 instanceId
-}
-
-/** A task that has been scheduled. */
-struct ScheduledTask {
-  /** The task that was scheduled. */
-  1: AssignedTask assignedTask
-  /** The current status of this task. */
-  2: ScheduleStatus status
-  /**
-   * The number of failures that this task has accumulated over the multi-generational history of
-   * this task.
-   */
-  3: i32 failureCount
-  /** State change history for this task. */
-  4: list<TaskEvent> taskEvents
-  /**
-   * The task ID of the previous generation of this task.  When a task is automatically rescheduled,
-   * a copy of the task is created and ancestor ID of the previous task's task ID.
-   */
-  5: string ancestorId
-}
-
-struct ScheduleStatusResult {
-  1: list<ScheduledTask> tasks
-}
-
-struct GetJobsResult {
-  1: set<JobConfiguration> configs
-}
-
-/**
- * Contains a set of restrictions on matching tasks where all restrictions must be met
- * (terms are AND'ed together).
- */
-struct TaskQuery {
-  // TODO(maxim): Remove in 0.7.0. (AURORA-749)
-  8: Identity owner
-  14: string role
-  9: string environment
-  2: string jobName
-  4: set<string> taskIds
-  5: set<ScheduleStatus> statuses
-  7: set<i32> instanceIds
-  10: set<string> slaveHosts
-  11: set<JobKey> jobKeys
-  12: i32 offset
-  13: i32 limit
-}
-
-struct HostStatus {
-  1: string host
-  2: MaintenanceMode mode
-}
-
-struct RoleSummary {
-  1: string role
-  2: i32 jobCount
-  3: i32 cronJobCount
-}
-
-struct Hosts {
-  1: set<string> hostNames
-}
-
-struct PendingReason {
-  1: string taskId
-  2: string reason
-}
-
-/** States that a job update may be in. */
-enum JobUpdateStatus {
-  /** Update is in progress. */
-  ROLLING_FORWARD = 0,
-
-  /** Update has failed and is being rolled back. */
-  ROLLING_BACK = 1,
-
-  /** Update has been paused while in progress. */
-  ROLL_FORWARD_PAUSED = 2,
-
-  /** Update has been paused during rollback. */
-  ROLL_BACK_PAUSED = 3,
-
-  /** Update has completed successfully. */
-  ROLLED_FORWARD = 4,
-
-  /** Update has failed and rolled back. */
-  ROLLED_BACK = 5,
-
-  /** Update was aborted. */
-  ABORTED = 6,
-
-  /** Unknown error during update. */
-  ERROR = 7
-
-  /**
-   * Update failed to complete.
-   * This can happen if failure thresholds are met while rolling forward, but rollback is disabled,
-   * or if failure thresholds are met when rolling back.
-   */
-  FAILED = 8
-}
-
-/** States the job update can be in while still considered active. */
-const set<JobUpdateStatus> ACTIVE_JOB_UPDATE_STATES = [JobUpdateStatus.ROLLING_FORWARD,
-                                                       JobUpdateStatus.ROLLING_BACK,
-                                                       JobUpdateStatus.ROLL_FORWARD_PAUSED,
-                                                       JobUpdateStatus.ROLL_BACK_PAUSED]
-
-/** Job update actions that can be applied to job instances. */
-enum JobUpdateAction {
-  /**
-   * An instance was moved to the target state successfully, and declared healthy if the desired
-   * state did not involve deleting the instance.
-   */
-  INSTANCE_UPDATED = 1,
-
-  /**
-   * An instance was rolled back because the job update did not succeed.  The instance was reverted
-   * to the original state prior to the job update, which means that the instance was removed if
-   * the update added instances to the job.
-   */
-  INSTANCE_ROLLED_BACK = 2,
-
-  /**
-   * An instance is being moved from the original state to the desired state.
-   */
-  INSTANCE_UPDATING = 3,
-
-  /**
-   * An instance is being moved from the desired state back to the original state, because the job
-   * update failed.
-   */
-  INSTANCE_ROLLING_BACK = 4,
-
-  /** An instance update was attempted but failed and was not rolled back. */
-  INSTANCE_UPDATE_FAILED = 5,
-
-  /** An instance rollback was attempted but failed. */
-  INSTANCE_ROLLBACK_FAILED = 6
-}
-
-/** Status of the coordinated update. Intended as a response to pulseJobUpdate RPC. */
-enum JobUpdatePulseStatus {
-  /**
-   *  Update is active (ACK).
-   */
-  OK = 1,
-
-  /**
-   * Update is paused and will not progress unless explicitly resumed (NACK).
-   */
-  PAUSED = 2,
-
-  /**
-   * Update has reached terminal state.
-   */
-  FINISHED = 3
-}
-
-/** Job update thresholds and limits. */
-struct JobUpdateSettings {
-  /** Max number of instances being updated at any given moment. */
-  1: i32 updateGroupSize
-
-  /** Max number of instance failures to tolerate before marking instance as FAILED. */
-  2: i32 maxPerInstanceFailures
-
-  /** Max number of FAILED instances to tolerate before terminating the update. */
-  3: i32 maxFailedInstances
-
-  /** Max time to wait until an instance reaches RUNNING state. */
-  4: i32 maxWaitToInstanceRunningMs
-
-  /** Min time to watch a RUNNING instance. */
-  5: i32 minWaitInInstanceRunningMs
-
-  /** If true, enables failed update rollback. */
-  6: bool rollbackOnFailure
-
-  /** Instance IDs to act on. All instances will be affected if this is not set. */
-  7: set<Range> updateOnlyTheseInstances
-
-  /**
-   * If true, use updateGroupSize as strict batching boundaries, and avoid proceeding to another
-   * batch until the preceding batch finishes updating.
-   */
-  8: bool waitForBatchCompletion
-
- /**
-  * If set, requires external calls to pulseJobUpdate RPC within the specified rate for the
-  * update to make progress. If no pulses received within specified interval the update will
-  * block. A blocked update is unable to continue but retains its current status. It may only get
-  * unblocked by a fresh pulseJobUpdate call.
-  */
-  9: i32 blockIfNoPulsesAfterMs
-}
-
-/** Event marking a state transition in job update lifecycle. */
-struct JobUpdateEvent {
-  /** Update status. */
-  1: JobUpdateStatus status
-
-  /** Epoch timestamp in milliseconds. */
-  2: i64 timestampMs
-
-  /** User who performed this event (if user-initiated). */
-  3: optional string user
-}
-
-/** Event marking a state transition in job instance update lifecycle. */
-struct JobInstanceUpdateEvent {
-  /** Job instance ID. */
-  1: i32 instanceId
-
-  /** Epoch timestamp in milliseconds. */
-  2: i64 timestampMs
-
-  /** Job update action taken on the instance. */
-  3: JobUpdateAction action
-}
-
-/** Maps instance IDs to TaskConfigs it. */
-struct InstanceTaskConfig {
-  /** A TaskConfig associated with instances. */
-  1: TaskConfig task
-
-  /** Instances associated with the TaskConfig. */
-  2: set<Range> instances
-}
-
-/** Current job update state including status and created/modified timestamps. */
-struct JobUpdateState {
-  /** Current status of the update. */
-  1: JobUpdateStatus status
-
-  /** Created timestamp in milliseconds. */
-  2: i64 createdTimestampMs
-
-  /** Last modified timestamp in milliseconds. */
-  3: i64 lastModifiedTimestampMs
-}
-
-/** Summary of the job update including job key, user and current state. */
-struct JobUpdateSummary {
-  /** Update ID. */
-  1: string updateId
-
-  /** Job key. */
-  2: JobKey jobKey
-
-  /** User initiated an update. */
-  3: string user
-
-  /** Current job update state. */
-  4: JobUpdateState state
-}
-
-/** Update configuration and setting details. */
-struct JobUpdateInstructions {
-  /** Actual InstanceId -> TaskConfig mapping when the update was requested. */
-  1: set<InstanceTaskConfig> initialState
-
-  /** Desired configuration when the update completes. */
-  2: InstanceTaskConfig desiredState
-
-  /** Update specific settings. */
-  3: JobUpdateSettings settings
-}
-
-/** Full definition of the job update. */
-struct JobUpdate {
-  /** Update summary. */
-  1: JobUpdateSummary summary
-
-  /** Update configuration. */
-  2: JobUpdateInstructions instructions
-}
-
-struct JobUpdateDetails {
-  /** Update definition. */
-  1: JobUpdate update
-
-  /** History for this update. */
-  2: list<JobUpdateEvent> updateEvents
-
-  /** History for the individual instances updated. */
-  3: list<JobInstanceUpdateEvent> instanceEvents
-}
-
-/** A request to update the following instances of an existing job. Used by startUpdate. */
-struct JobUpdateRequest {
-  /** Desired TaskConfig to apply. */
-  1: TaskConfig taskConfig
-
-  /** Desired number of instances of the task config. */
-  2: i32 instanceCount
-
-  /** Update settings and limits. */
-  3: JobUpdateSettings settings
-}
-
-/**
- * Contains a set of restrictions on matching job updates where all restrictions must be met
- * (terms are AND'ed together).
- */
-struct JobUpdateQuery {
-  /** Update ID. */
-  1: string updateId
-
-  /** Job role. */
-  2: string role
-
-  /** Job key. */
-  3: JobKey jobKey
-
-  /** User who created the update. */
-  4: string user
-
-  /** Set of update statuses. */
-  5: set<JobUpdateStatus> updateStatuses
-
-  /** Offset to serve data from. Used by pagination. */
-  6: i32 offset
-
-  /** Number or records to serve. Used by pagination. */
-  7: i32 limit
-}
-
-struct ListBackupsResult {
-  1: set<string> backups
-}
-
-struct StartMaintenanceResult {
-  1: set<HostStatus> statuses
-}
-
-struct DrainHostsResult {
-  1: set<HostStatus> statuses
-}
-
-struct QueryRecoveryResult {
-  1: set<ScheduledTask> tasks
-}
-
-struct MaintenanceStatusResult {
-  1: set<HostStatus> statuses
-}
-
-struct EndMaintenanceResult {
-  1: set<HostStatus> statuses
-}
-
-struct RoleSummaryResult {
-  1: set<RoleSummary> summaries
-}
-
-struct JobSummaryResult {
-  1: set<JobSummary> summaries
-}
-
-struct GetLocksResult {
-  1: set<Lock> locks
-}
-
-struct ConfigSummaryResult {
-  1: ConfigSummary summary
-}
-
-struct GetPendingReasonResult {
-  1: set<PendingReason> reasons
-}
-
-/** Result of the startUpdate call. */
-struct StartJobUpdateResult {
-  /** Job update ID. */
-  1: string updateId
-}
-
-/** Result of the getJobUpdateSummaries call. */
-struct GetJobUpdateSummariesResult {
-  1: list<JobUpdateSummary> updateSummaries
-}
-
-/** Result of the getJobUpdateDetails call. */
-struct GetJobUpdateDetailsResult {
-  1: JobUpdateDetails details
-}
-
-/** Result of the pulseJobUpdate call. */
-struct PulseJobUpdateResult {
-  1: JobUpdatePulseStatus status
-}
-
-/** Information about the scheduler. */
-struct ServerInfo {
-  1: string clusterName
-  2: i32 thriftAPIVersion
-  /** A url prefix for job container stats. */
-  3: string statsUrlPrefix
-}
-
-union Result {
-  1: PopulateJobResult populateJobResult
-  3: ScheduleStatusResult scheduleStatusResult
-  4: GetJobsResult getJobsResult
-  5: GetQuotaResult getQuotaResult
-  6: ListBackupsResult listBackupsResult
-  7: StartMaintenanceResult startMaintenanceResult
-  8: DrainHostsResult drainHostsResult
-  9: QueryRecoveryResult queryRecoveryResult
-  10: MaintenanceStatusResult maintenanceStatusResult
-  11: EndMaintenanceResult endMaintenanceResult
-  15: APIVersion getVersionResult
-  16: AcquireLockResult acquireLockResult
-  17: RoleSummaryResult roleSummaryResult
-  18: JobSummaryResult jobSummaryResult
-  19: GetLocksResult getLocksResult
-  20: ConfigSummaryResult configSummaryResult
-  21: GetPendingReasonResult getPendingReasonResult
-  22: StartJobUpdateResult startJobUpdateResult
-  23: GetJobUpdateSummariesResult getJobUpdateSummariesResult
-  24: GetJobUpdateDetailsResult getJobUpdateDetailsResult
-  25: PulseJobUpdateResult pulseJobUpdateResult
-}
-
-struct ResponseDetail {
-  1: string message
-}
-
-struct Response {
-  1: ResponseCode responseCode
-  // TODO(wfarner): Remove the message field in 0.7.0. (AURORA-466)
-  2: optional string messageDEPRECATED
-  // TODO(wfarner): Remove version field in 0.7.0. (AURORA-467)
-  4: APIVersion DEPRECATEDversion
-  5: ServerInfo serverInfo
-  /** Payload from the invoked RPC. */
-  3: optional Result result
-  /**
-   * Messages from the server relevant to the request, such as warnings or use of deprecated
-   * features.
-   */
-  6: list<ResponseDetail> details
-}
-
-// A service that provides all the read only calls to the Aurora scheduler.
-service ReadOnlyScheduler {
-  /** Returns a summary of the jobs grouped by role. */
-  Response getRoleSummary()
-
-  /** Returns a summary of jobs, optionally only those owned by a specific role. */
-  Response getJobSummary(1: string role)
-
-  /** Fetches the status of tasks. */
-  Response getTasksStatus(1: TaskQuery query)
-
-  /**
-   * Same as getTaskStatus but without the TaskConfig.ExecutorConfig data set.
-   * This is an interim solution until we have a better way to query TaskConfigs (AURORA-541).
-   */
-  Response getTasksWithoutConfigs(1: TaskQuery query)
-
-  /** Returns user-friendly reasons (if available) for tasks retained in PENDING state. */
-  Response getPendingReason(1: TaskQuery query)
-
-  /** Fetches the configuration summary of active tasks for the specified job. */
-  Response getConfigSummary(1: JobKey job)
-
-  /**
-   * Fetches the status of jobs.
-   * ownerRole is optional, in which case all jobs are returned.
-   */
-  Response getJobs(1: string ownerRole)
-
-  /** Fetches the quota allocated for a user. */
-  Response getQuota(1: string ownerRole)
-
-  // TODO(Suman Karumuri): Delete this API once it is no longer used.
-  /**
-   * Returns the current version of the API implementation
-   * NOTE: This method is deprecated.
-   */
-  Response getVersion()
-
-  /**
-   * Populates fields in a job configuration as though it were about to be run.
-   * This can be used to diff a configuration running tasks.
-   */
-  Response populateJobConfig(1: JobConfiguration description)
-
-  /** Returns all stored context specific resource/operation locks. */
-  Response getLocks()
-
-  /** Gets job update summaries. Not implemented yet. */
-  Response getJobUpdateSummaries(1: JobUpdateQuery jobUpdateQuery)
-
-  /** Gets job update details. Not implemented yet. */
-  Response getJobUpdateDetails(1: string updateId)
-}
-
-// Due to assumptions in the client all authenticated RPCs must have a SessionKey as their
-// last argument. Note that the order in this file is what matters, and message numbers should still
-// never be reused.
-service AuroraSchedulerManager extends ReadOnlyScheduler {
-  /**
-   * Creates a new job.  The request will be denied if a job with the provided name already exists
-   * in the cluster.
-   */
-  Response createJob(1: JobConfiguration description, 3: Lock lock, 2: SessionKey session)
-
-  /**
-   * Enters a job into the cron schedule, without actually starting the job.
-   * If the job is already present in the schedule, this will update the schedule entry with the new
-   * configuration.
-   */
-  Response scheduleCronJob(1: JobConfiguration description, 3: Lock lock, 2: SessionKey session)
-
-  /**
-   * Removes a job from the cron schedule. The request will be denied if the job was not previously
-   * scheduled with scheduleCronJob.
-   */
-  Response descheduleCronJob(4: JobKey job, 3: Lock lock, 2: SessionKey session)
-
-  /**
-   * Starts a cron job immediately.  The request will be denied if the specified job does not
-   * exist for the role account, or the job is not a cron job.
-   */
-  Response startCronJob(4: JobKey job, 3: SessionKey session)
-
-  /** Restarts a batch of shards. */
-  Response restartShards(5: JobKey job, 3: set<i32> shardIds, 6: Lock lock 4: SessionKey session)
-
-  /** Initiates a kill on tasks. */
-  Response killTasks(1: TaskQuery query, 3: Lock lock, 2: SessionKey session)
-
-  /**
-   * Adds new instances specified by the AddInstancesConfig. A job represented by the JobKey must be
-   * protected by Lock.
-   */
-  Response addInstances(
-      1: AddInstancesConfig config,
-      2: Lock lock,
-      3: SessionKey session)
-
-  /**
-   * Creates and saves a new Lock instance guarding against multiple mutating operations within the
-   * context defined by LockKey.
-   */
-  Response acquireLock(1: LockKey lockKey, 2: SessionKey session)
-
-  /** Releases the lock acquired earlier in acquireLock call. */
-  Response releaseLock(1: Lock lock, 2: LockValidation validation, 3: SessionKey session)
-
-  /**
-   * Replaces the template (configuration) for the existing cron job.
-   * The cron job template (configuration) must exist for the call to succeed.
-   */
-  Response replaceCronTemplate(1: JobConfiguration config, 2: Lock lock, 3: SessionKey session)
-
-  /** Starts update of the existing service job. Not implemented yet. */
-  Response startJobUpdate(1: JobUpdateRequest request, 2: SessionKey session)
-
-  /**
-   * Pauses the update progress for the specified job. Can be resumed by resumeUpdate call.
-   * Not implemented yet.
-   */
-  Response pauseJobUpdate(1: JobKey jobKey, 2: SessionKey session)
-
-  /** Resumes progress of a previously paused job update. Not implemented yet. */
-  Response resumeJobUpdate(1: JobKey jobKey, 2: SessionKey session)
-
-  /** Permanently aborts the job update. Does not remove the update history. Not implemented yet. */
-  Response abortJobUpdate(1: JobKey jobKey, 2: SessionKey session)
-
-  /**
-   * Allows progress of the job update in case blockIfNoPulsesAfterMs is specified in
-   * JobUpdateSettings. Unblocks progress if the update was previously blocked.
-   * Responds with ResponseCode.INVALID_REQUEST in case an unknown updateId is specified.
-   */
-  Response pulseJobUpdate(1: string updateId, 2: SessionKey session)
-}
-
-struct InstanceConfigRewrite {
-  /** Key for the task to rewrite. */
-  1: InstanceKey instanceKey
-  /** The original configuration. */
-  2: TaskConfig oldTask
-  /** The rewritten configuration. */
-  3: TaskConfig rewrittenTask
-}
-
-struct JobConfigRewrite {
-  /** The original job configuration. */
-  1: JobConfiguration oldJob
-  /** The rewritten job configuration. */
-  2: JobConfiguration rewrittenJob
-}
-
-union ConfigRewrite {
-  1: JobConfigRewrite jobRewrite
-  2: InstanceConfigRewrite instanceRewrite
-}
-
-struct RewriteConfigsRequest {
-  1: list<ConfigRewrite> rewriteCommands
-}
-
-// It would be great to compose these services rather than extend, but that won't be possible until
-// https://issues.apache.org/jira/browse/THRIFT-66 is resolved.
-service AuroraAdmin extends AuroraSchedulerManager {
-  /** Assign quota to a user.  This will overwrite any pre-existing quota for the user. */
-  Response setQuota(1: string ownerRole, 2: ResourceAggregate quota, 3: SessionKey session)
-
-  /**
-   * Forces a task into a specific state.  This does not guarantee the task will enter the given
-   * state, as the task must still transition within the bounds of the state machine.  However,
-   * it attempts to enter that state via the state machine.
-   */
-  Response forceTaskState(
-      1: string taskId,
-      2: ScheduleStatus status,
-      3: SessionKey session)
-
-  /** Immediately writes a storage snapshot to disk. */
-  Response performBackup(1: SessionKey session)
-
-  /** Lists backups that are available for recovery. */
-  Response listBackups(1: SessionKey session)
-
-  /** Loads a backup to an in-memory storage.  This must precede all other recovery operations. */
-  Response stageRecovery(1: string backupId, 2: SessionKey session)
-
-  /** Queries for tasks in a staged recovery. */
-  Response queryRecovery(1: TaskQuery query, 2: SessionKey session)
-
-  /** Deletes tasks from a staged recovery. */
-  Response deleteRecoveryTasks(1: TaskQuery query, 2: SessionKey session)
-
-  /** Commits a staged recovery, completely replacing the previous storage state. */
-  Response commitRecovery(1: SessionKey session)
-
-  /** Unloads (aborts) a staged recovery. */
-  Response unloadRecovery(1: SessionKey session)
-
-  /** Put the given hosts into maintenance mode. */
-  Response startMaintenance(1: Hosts hosts, 2: SessionKey session)
-
-  /** Ask scheduler to begin moving tasks scheduled on given hosts. */
-  Response drainHosts(1: Hosts hosts, 2: SessionKey session)
-
-  /** Retrieve the current maintenance states for a group of hosts. */
-  Response maintenanceStatus(1: Hosts hosts, 2: SessionKey session)
-
-  /** Set the given hosts back into serving mode. */
-  Response endMaintenance(1: Hosts hosts, 2: SessionKey session)
-
-  /** Start a storage snapshot and block until it completes. */
-  Response snapshot(1: SessionKey session)
-
-  /**
-   * Forcibly rewrites the stored definition of user configurations.  This is intended to be used
-   * in a controlled setting, primarily to migrate pieces of configurations that are opaque to the
-   * scheduler (e.g. executorConfig).
-   * The scheduler may do some validation of the rewritten configurations, but it is important
-   * that the caller take care to provide valid input and alter only necessary fields.
-   */
-  Response rewriteConfigs(1: RewriteConfigsRequest request, 2: SessionKey session)
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/91b8d193/src/main/thrift/org/apache/aurora/gen/internal_rpc.thrift
----------------------------------------------------------------------
diff --git a/src/main/thrift/org/apache/aurora/gen/internal_rpc.thrift b/src/main/thrift/org/apache/aurora/gen/internal_rpc.thrift
deleted file mode 100644
index a2c230f..0000000
--- a/src/main/thrift/org/apache/aurora/gen/internal_rpc.thrift
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace java org.apache.aurora.gen.comm
-namespace py gen.apache.aurora.comm
-
-include "api.thrift"
-
-// Thrift interface to define the communication between the scheduler and executor.
-
-// Message sent from the scheduler to the executor, indicating that some
-// task history associated with the host may have been purged, and the
-// executor should only retain tasks associated with the provided tasks IDs.
-struct AdjustRetainedTasks {
-  2: map<string, api.ScheduleStatus> retainedTasks  // All tasks that the executor should
-                                                    // retain, and their statuses.
-}


Mime
View raw message