aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject git commit: Removing quota checks from populateJobConfig RPC.
Date Thu, 06 Feb 2014 21:29:55 GMT
Updated Branches:
  refs/heads/master d2dc5715b -> 1590d5b0e


Removing quota checks from populateJobConfig RPC.

Bugs closed: AURORA-192

Reviewed at https://reviews.apache.org/r/17729/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/1590d5b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/1590d5b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/1590d5b0

Branch: refs/heads/master
Commit: 1590d5b0edbe5cb7bee7e275cf53a79f03c8402e
Parents: d2dc571
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Thu Feb 6 13:25:37 2014 -0800
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Thu Feb 6 13:25:37 2014 -0800

----------------------------------------------------------------------
 .../aurora/scheduler/state/SchedulerCore.java   |  8 -------
 .../scheduler/state/SchedulerCoreImpl.java      |  8 -------
 .../thrift/SchedulerThriftInterface.java        | 11 ++--------
 .../python/apache/aurora/client/api/__init__.py |  4 ++--
 .../python/apache/aurora/client/api/updater.py  |  3 +--
 .../thrift/org/apache/aurora/gen/api.thrift     |  8 +------
 .../state/BaseSchedulerCoreImplTest.java        | 22 -------------------
 .../thrift/SchedulerThriftInterfaceTest.java    | 23 +-------------------
 .../scheduler/thrift/aop/ForwardingThrift.java  |  8 ++-----
 .../apache/aurora/client/api/test_updater.py    |  3 +--
 .../org/apache/aurora/gen/api.thrift.md5        |  2 +-
 11 files changed, 11 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/src/main/java/org/apache/aurora/scheduler/state/SchedulerCore.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/state/SchedulerCore.java b/src/main/java/org/apache/aurora/scheduler/state/SchedulerCore.java
index 15ff590..7a13a8b 100644
--- a/src/main/java/org/apache/aurora/scheduler/state/SchedulerCore.java
+++ b/src/main/java/org/apache/aurora/scheduler/state/SchedulerCore.java
@@ -63,14 +63,6 @@ public interface SchedulerCore {
       throws ScheduleException;
 
   /**
-   * Validates the new job configuration passes resource filters.
-   *
-   * @param sanitizedConfiguration Job configuration to validate.
-   * @throws ScheduleException If job resources do not pass filters.
-   */
-  void validateJobResources(SanitizedConfiguration sanitizedConfiguration) throws ScheduleException;
-
-  /**
    * Starts a cron job immediately.
    *
    * @param jobKey Job key.

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/src/main/java/org/apache/aurora/scheduler/state/SchedulerCoreImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/state/SchedulerCoreImpl.java b/src/main/java/org/apache/aurora/scheduler/state/SchedulerCoreImpl.java
index 8b7e470..336e91b 100644
--- a/src/main/java/org/apache/aurora/scheduler/state/SchedulerCoreImpl.java
+++ b/src/main/java/org/apache/aurora/scheduler/state/SchedulerCoreImpl.java
@@ -194,14 +194,6 @@ class SchedulerCoreImpl implements SchedulerCore {
   }
 
   @Override
-  public void validateJobResources(SanitizedConfiguration sanitizedConfiguration)
-      throws ScheduleException {
-
-    IJobConfiguration job = sanitizedConfiguration.getJobConfig();
-    validateTaskLimits(job.getTaskConfig(), job.getInstanceCount());
-  }
-
-  @Override
   public void addInstances(
       final IJobKey jobKey,
       final ImmutableSet<Integer> instanceIds,

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
b/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
index a03627d..7f7e34d 100644
--- a/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
+++ b/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
@@ -67,7 +67,6 @@ import org.apache.aurora.gen.Hosts;
 import org.apache.aurora.gen.InstanceConfigRewrite;
 import org.apache.aurora.gen.InstanceKey;
 import org.apache.aurora.gen.JobConfigRewrite;
-import org.apache.aurora.gen.JobConfigValidation;
 import org.apache.aurora.gen.JobConfiguration;
 import org.apache.aurora.gen.JobKey;
 import org.apache.aurora.gen.JobSummary;
@@ -306,8 +305,7 @@ class SchedulerThriftInterface implements AuroraAdmin.Iface {
   }
 
   @Override
-  public Response populateJobConfig(JobConfiguration description, JobConfigValidation validation)
{
-
+  public Response populateJobConfig(JobConfiguration description) {
     checkNotNull(description);
 
     Response response = new Response();
@@ -315,17 +313,12 @@ class SchedulerThriftInterface implements AuroraAdmin.Iface {
       SanitizedConfiguration sanitized =
           SanitizedConfiguration.fromUnsanitized(IJobConfiguration.build(description));
 
-      // TODO(maximk): Drop it once migration to client quota checks is completed.
-      if (validation != null && validation == JobConfigValidation.RUN_FILTERS) {
-        schedulerCore.validateJobResources(sanitized);
-      }
-
       PopulateJobResult result = new PopulateJobResult()
           .setPopulated(ITaskConfig.toBuildersSet(sanitized.getTaskConfigs().values()));
       response.setResult(Result.populateJobResult(result))
           .setResponseCode(OK)
           .setMessage("Tasks populated");
-    } catch (TaskDescriptionException | ScheduleException e) {
+    } catch (TaskDescriptionException e) {
       response.setResponseCode(INVALID_REQUEST)
           .setMessage("Invalid configuration: " + e.getMessage());
     }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/src/main/python/apache/aurora/client/api/__init__.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/__init__.py b/src/main/python/apache/aurora/client/api/__init__.py
index fbdf2b3..8bc05e2 100644
--- a/src/main/python/apache/aurora/client/api/__init__.py
+++ b/src/main/python/apache/aurora/client/api/__init__.py
@@ -62,8 +62,8 @@ class AuroraClientAPI(object):
     log.debug('Lock %s' % lock)
     return self._scheduler_proxy.createJob(config.job(), lock)
 
-  def populate_job_config(self, config, validation=None):
-    return self._scheduler_proxy.populateJobConfig(config.job(), validation)
+  def populate_job_config(self, config):
+    return self._scheduler_proxy.populateJobConfig(config.job())
 
   def start_cronjob(self, job_key):
     self._assert_valid_job_key(job_key)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/src/main/python/apache/aurora/client/api/updater.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/updater.py b/src/main/python/apache/aurora/client/api/updater.py
index 39ccb1d..898024e 100644
--- a/src/main/python/apache/aurora/client/api/updater.py
+++ b/src/main/python/apache/aurora/client/api/updater.py
@@ -21,7 +21,6 @@ from difflib import unified_diff
 from gen.apache.aurora.constants import ACTIVE_STATES
 from gen.apache.aurora.ttypes import (
     AddInstancesConfig,
-    JobConfigValidation,
     JobKey,
     Identity,
     Lock,
@@ -389,7 +388,7 @@ class Updater(object):
 
     Returns a TaskConfig populated with default values.
     """
-    resp = self._scheduler.populateJobConfig(self._config.job(), JobConfigValidation.RUN_FILTERS)
+    resp = self._scheduler.populateJobConfig(self._config.job())
     self._check_and_log_response(resp)
 
     # Safe to take the first element as Scheduler would throw in case zero instances provided.

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/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
index 77cd09e..e5a3675 100644
--- a/src/main/thrift/org/apache/aurora/gen/api.thrift
+++ b/src/main/thrift/org/apache/aurora/gen/api.thrift
@@ -397,12 +397,6 @@ struct JobSummaryResult {
   1: set<JobSummary> summaries
 }
 
-// Specifies validation level for the populateJobConfig.
-enum JobConfigValidation {
-  NONE              = 0   // No additional job config validation would be performed (only
parsing).
-  RUN_FILTERS       = 1   // In addition to parsing config, will run through job filters.
-}
-
 union Result {
   1: PopulateJobResult populateJobResult
   3: ScheduleStatusResult scheduleStatusResult
@@ -455,7 +449,7 @@ service AuroraSchedulerManager extends ReadOnlyScheduler {
 
   // 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, 2: JobConfigValidation validation)
+  Response populateJobConfig(1: JobConfiguration description)
 
   // 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.

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/src/test/java/org/apache/aurora/scheduler/state/BaseSchedulerCoreImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/state/BaseSchedulerCoreImplTest.java
b/src/test/java/org/apache/aurora/scheduler/state/BaseSchedulerCoreImplTest.java
index 8ad5e7a..095cc4a 100644
--- a/src/test/java/org/apache/aurora/scheduler/state/BaseSchedulerCoreImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/state/BaseSchedulerCoreImplTest.java
@@ -1134,28 +1134,6 @@ public abstract class BaseSchedulerCoreImplTest extends EasyMockTest
{
   }
 
   @Test
-  public void testEnsureCanAddInstances() throws Exception {
-    SanitizedConfiguration job = makeJob(KEY_A, 1);
-
-    control.replay();
-    buildScheduler();
-
-    scheduler.validateJobResources(job);
-  }
-
-  @Test(expected = ScheduleException.class)
-  public void testEnsureCanAddInstancesFails() throws Exception {
-    SanitizedConfiguration job = makeJob(KEY_A, 1);
-    expect(quotaManager.checkQuota(anyObject(ITaskConfig.class), anyInt()))
-        .andReturn(NOT_ENOUGH_QUOTA);
-
-    control.replay();
-    buildScheduler();
-
-    scheduler.validateJobResources(job);
-  }
-
-  @Test
   public void testTaskIdLimit() throws Exception {
     taskIdGenerator = new TaskIdGenerator() {
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
index 4cb84da..656e44e 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
@@ -46,7 +46,6 @@ import org.apache.aurora.gen.Identity;
 import org.apache.aurora.gen.InstanceConfigRewrite;
 import org.apache.aurora.gen.InstanceKey;
 import org.apache.aurora.gen.JobConfigRewrite;
-import org.apache.aurora.gen.JobConfigValidation;
 import org.apache.aurora.gen.JobConfiguration;
 import org.apache.aurora.gen.JobKey;
 import org.apache.aurora.gen.JobSummary;
@@ -186,33 +185,13 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
   @Test
   public void testPopulateJobConfig() throws Exception {
     IJobConfiguration job = IJobConfiguration.build(makeJob());
-    scheduler.validateJobResources(anyObject(SanitizedConfiguration.class));
     control.replay();
 
-    Response response = thrift.populateJobConfig(job.newBuilder(), JobConfigValidation.RUN_FILTERS);
+    Response response = thrift.populateJobConfig(job.newBuilder());
     assertEquals(ResponseCode.OK, response.getResponseCode());
   }
 
   @Test
-  public void testPopulateJobConfigNoValidation() throws Exception {
-    control.replay();
-
-    Response response = thrift.populateJobConfig(makeJob(), null);
-    assertEquals(ResponseCode.OK, response.getResponseCode());
-  }
-
-  @Test
-  public void testPopulateJobConfigFailQuotaCheck() throws Exception {
-    IJobConfiguration job = IJobConfiguration.build(makeJob());
-    scheduler.validateJobResources(anyObject(SanitizedConfiguration.class));
-    expectLastCall().andThrow(new ScheduleException("err"));
-    control.replay();
-
-    Response response = thrift.populateJobConfig(job.newBuilder(), JobConfigValidation.RUN_FILTERS);
-    assertEquals(ResponseCode.INVALID_REQUEST, response.getResponseCode());
-  }
-
-  @Test
   public void testCreateJobNoLock() throws Exception {
     IJobConfiguration job = IJobConfiguration.build(makeJob());
     expectAuth(ROLE, true);

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/src/test/java/org/apache/aurora/scheduler/thrift/aop/ForwardingThrift.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/aop/ForwardingThrift.java b/src/test/java/org/apache/aurora/scheduler/thrift/aop/ForwardingThrift.java
index 62fc804..b4f7775 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/aop/ForwardingThrift.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/aop/ForwardingThrift.java
@@ -20,7 +20,6 @@ import java.util.Set;
 import org.apache.aurora.gen.AddInstancesConfig;
 import org.apache.aurora.gen.AuroraAdmin;
 import org.apache.aurora.gen.Hosts;
-import org.apache.aurora.gen.JobConfigValidation;
 import org.apache.aurora.gen.JobConfiguration;
 import org.apache.aurora.gen.JobKey;
 import org.apache.aurora.gen.Lock;
@@ -125,11 +124,8 @@ abstract class ForwardingThrift implements AuroraAdmin.Iface {
   }
 
   @Override
-  public Response populateJobConfig(
-      JobConfiguration description,
-      JobConfigValidation validation) throws TException {
-
-    return delegate.populateJobConfig(description, validation);
+  public Response populateJobConfig(JobConfiguration description) throws TException {
+    return delegate.populateJobConfig(description);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/src/test/python/apache/aurora/client/api/test_updater.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_updater.py b/src/test/python/apache/aurora/client/api/test_updater.py
index eabb938..ece0714 100644
--- a/src/test/python/apache/aurora/client/api/test_updater.py
+++ b/src/test/python/apache/aurora/client/api/test_updater.py
@@ -32,7 +32,6 @@ from gen.apache.aurora.ttypes import (
   Constraint,
   ExecutorConfig,
   JobConfiguration,
-  JobConfigValidation,
   JobKey,
   Identity,
   LimitConstraint,
@@ -152,7 +151,7 @@ class UpdaterTest(TestCase):
     resp = Response(responseCode=response_code, message='test')
     result = set([deepcopy(job_config.taskConfig)])
     resp.result = Result(populateJobResult=PopulateJobResult(populated=result))
-    self._scheduler.populateJobConfig(job_config, JobConfigValidation.RUN_FILTERS).AndReturn(resp)
+    self._scheduler.populateJobConfig(job_config).AndReturn(resp)
 
   def expect_get_tasks(self, tasks, ignore_ids=None, response_code=None):
     response_code = ResponseCode.OK if response_code is None else response_code

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/1590d5b0/src/test/resources/org/apache/aurora/gen/api.thrift.md5
----------------------------------------------------------------------
diff --git a/src/test/resources/org/apache/aurora/gen/api.thrift.md5 b/src/test/resources/org/apache/aurora/gen/api.thrift.md5
index 10fcf08..22042a4 100644
--- a/src/test/resources/org/apache/aurora/gen/api.thrift.md5
+++ b/src/test/resources/org/apache/aurora/gen/api.thrift.md5
@@ -1 +1 @@
-5eb4a77a6a99b6836e099825fafd56e2
+63ed50d02363dadde8422b08a163add4


Mime
View raw message