aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject [2/2] aurora git commit: Remove lock-related constructs from the API.
Date Tue, 05 Apr 2016 22:27:29 GMT
Remove lock-related constructs from the API.

Bugs closed: AURORA-1581

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


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

Branch: refs/heads/master
Commit: a9b3df88e8b03fff1f7e4dcaa501343c1feba130
Parents: 5109788
Author: Bill Farner <wfarner@apache.org>
Authored: Tue Apr 5 15:27:26 2016 -0700
Committer: Bill Farner <wfarner@apache.org>
Committed: Tue Apr 5 15:27:26 2016 -0700

----------------------------------------------------------------------
 RELEASE-NOTES.md                                |  13 +
 .../thrift/org/apache/aurora/gen/api.thrift     |  47 +---
 .../scheduler/http/JettyServerModule.java       |   1 -
 .../org/apache/aurora/scheduler/http/Locks.java |  93 -------
 .../aurora/scheduler/state/LockManager.java     |  12 +-
 .../aurora/scheduler/state/LockManagerImpl.java |  26 +-
 .../scheduler/thrift/ReadOnlySchedulerImpl.java |  14 +-
 .../thrift/SchedulerThriftInterface.java        |  93 ++-----
 .../thrift/aop/AnnotatedAuroraAdmin.java        |  31 +--
 src/main/python/apache/aurora/admin/admin.py    |  18 --
 .../python/apache/aurora/client/api/__init__.py |  29 +--
 .../apache/aurora/client/api/restarter.py       |   6 +-
 .../apache/aurora/client/hooks/hooked_api.py    |  12 +-
 .../apache/aurora/scheduler/http/LocksTest.java |  84 -------
 .../aurora/scheduler/http/api/ApiBetaTest.java  |  10 +-
 .../http/api/security/HttpSecurityIT.java       |  34 ++-
 .../ShiroAuthorizingParamInterceptorTest.java   |  12 +-
 .../scheduler/state/LockManagerImplTest.java    |  49 +---
 .../aurora/scheduler/thrift/Fixtures.java       |   4 -
 .../thrift/ReadOnlySchedulerImplTest.java       |  19 +-
 .../thrift/SchedulerThriftInterfaceTest.java    | 245 +++++++------------
 .../aurora/scheduler/thrift/ThriftIT.java       |   2 +-
 .../python/apache/aurora/admin/test_admin.py    |  45 +---
 src/test/python/apache/aurora/api_util.py       |  20 +-
 .../python/apache/aurora/client/api/test_api.py |   1 -
 .../apache/aurora/client/api/test_restarter.py  |  18 +-
 .../aurora/client/api/test_scheduler_client.py  |  24 +-
 .../apache/aurora/client/cli/test_restart.py    |   6 +-
 .../aurora/client/hooks/test_non_hooked_api.py  |   8 +-
 29 files changed, 207 insertions(+), 769 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/RELEASE-NOTES.md
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 2f935da..0e2e04b 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -35,6 +35,19 @@
   - `TaskConfig.jobName`
   - `TaskQuery.owner`
 - Removed deprecated executor argument `-announcer-enable`, which was a no-op in 0.12.0.
+- Removed deprecated API constructs related to Locks:
+  - removed RPCs that managed locks
+    - `acquireLock`
+    - `releaseLock`
+    - `getLocks`
+  - removed `Lock` parameters to RPCs
+    - `createJob`
+    - `scheduleCronJob`
+    - `descheduleCronJob`
+    - `restartShards`
+    - `killTasks`
+    - `addInstances`
+    - `replaceCronTemplate`
 - Task ID strings are no longer prefixed by a timestamp.
 
 0.12.0

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/api/src/main/thrift/org/apache/aurora/gen/api.thrift
----------------------------------------------------------------------
diff --git a/api/src/main/thrift/org/apache/aurora/gen/api.thrift b/api/src/main/thrift/org/apache/aurora/gen/api.thrift
index d4b8904..2412490 100644
--- a/api/src/main/thrift/org/apache/aurora/gen/api.thrift
+++ b/api/src/main/thrift/org/apache/aurora/gen/api.thrift
@@ -143,14 +143,6 @@ struct 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. */
@@ -347,12 +339,6 @@ struct GetQuotaResult {
   5: optional ResourceAggregate nonProdDedicatedConsumption
 }
 
-/** 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.
@@ -840,10 +826,6 @@ struct JobSummaryResult {
   1: set<JobSummary> summaries
 }
 
-struct GetLocksResult {
-  1: set<Lock> locks
-}
-
 struct ConfigSummaryResult {
   1: ConfigSummary summary
 }
@@ -905,10 +887,8 @@ union Result {
   9: QueryRecoveryResult queryRecoveryResult
   10: MaintenanceStatusResult maintenanceStatusResult
   11: EndMaintenanceResult endMaintenanceResult
-  16: AcquireLockResult acquireLockResult
   17: RoleSummaryResult roleSummaryResult
   18: JobSummaryResult jobSummaryResult
-  19: GetLocksResult getLocksResult
   20: ConfigSummaryResult configSummaryResult
   21: GetPendingReasonResult getPendingReasonResult
   22: StartJobUpdateResult startJobUpdateResult
@@ -972,9 +952,6 @@ service ReadOnlyScheduler {
    */
   Response populateJobConfig(1: JobConfiguration description)
 
-  /** Returns all stored context specific resource/operation locks. */
-  Response getLocks()
-
   /** Gets job update summaries. */
   Response getJobUpdateSummaries(1: JobUpdateQuery jobUpdateQuery)
 
@@ -990,20 +967,20 @@ 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)
+  Response createJob(1: JobConfiguration description)
 
   /**
    * 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)
+  Response scheduleCronJob(1: JobConfiguration description)
 
   /**
    * 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)
+  Response descheduleCronJob(4: JobKey job)
 
   /**
    * Starts a cron job immediately.  The request will be denied if the specified job does not
@@ -1012,10 +989,10 @@ service AuroraSchedulerManager extends ReadOnlyScheduler {
   Response startCronJob(4: JobKey job)
 
   /** Restarts a batch of shards. */
-  Response restartShards(5: JobKey job, 3: set<i32> shardIds, 6: Lock lock)
+  Response restartShards(5: JobKey job, 3: set<i32> shardIds)
 
   /** Initiates a kill on tasks. TODO(maxim): remove TaskQuery in AURORA-1591. */
-  Response killTasks(1: TaskQuery query, 3: Lock lock, 4: JobKey job, 5: set<i32> instances)
+  Response killTasks(1: TaskQuery query, 4: JobKey job, 5: set<i32> instances)
 
   /**
    * Adds new instances with the TaskConfig of the existing instance pointed by the key.
@@ -1023,25 +1000,15 @@ service AuroraSchedulerManager extends ReadOnlyScheduler {
    */
   Response addInstances(
       1: AddInstancesConfig config,
-      2: Lock lock,
       3: InstanceKey key,
       4: i32 count)
 
-  /**
-   * Creates and saves a new Lock instance guarding against multiple mutating operations within the
-   * context defined by LockKey.
-   */
-  Response acquireLock(1: LockKey lockKey)
-
-  /** Releases the lock acquired earlier in acquireLock call. */
-  Response releaseLock(1: Lock lock, 2: LockValidation validation)
-
   // TODO(maxim): reevaluate if it's still needed when client updater is gone (AURORA-785).
   /**
    * 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)
+  Response replaceCronTemplate(1: JobConfiguration config)
 
   /** Starts update of the existing service job. */
   Response startJobUpdate(
@@ -1168,4 +1135,4 @@ service AuroraAdmin extends AuroraSchedulerManager {
 }
 
 // The name of the header that should be sent to bypass leader redirection in the Scheduler.
-const string BYPASS_LEADER_REDIRECT_HEADER_NAME = 'Bypass-Leader-Redirect'
\ No newline at end of file
+const string BYPASS_LEADER_REDIRECT_HEADER_NAME = 'Bypass-Leader-Redirect'

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/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 a5446e3..5b5cde5 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
@@ -217,7 +217,6 @@ public class JettyServerModule extends AbstractModule {
           .put(Cron.class, "cron")
           .put(HealthHandler.class, "health")
           .put(LeaderHealth.class, "leaderhealth")
-          .put(Locks.class, "locks")
           .put(LogConfig.class, "logconfig")
           .put(Maintenance.class, "maintenance")
           .put(Mname.class, "mname")

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/main/java/org/apache/aurora/scheduler/http/Locks.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/Locks.java b/src/main/java/org/apache/aurora/scheduler/http/Locks.java
deleted file mode 100644
index 0931289..0000000
--- a/src/main/java/org/apache/aurora/scheduler/http/Locks.java
+++ /dev/null
@@ -1,93 +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.
- */
-package org.apache.aurora.scheduler.http;
-
-import java.util.Objects;
-
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Maps;
-
-import org.apache.aurora.gen.LockKey;
-import org.apache.aurora.scheduler.base.JobKeys;
-import org.apache.aurora.scheduler.state.LockManager;
-import org.apache.aurora.scheduler.storage.entities.ILock;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * Servlet that exposes existing resource/operation locks.
- */
-@Path("/locks")
-public class Locks {
-
-  private final LockManager lockManager;
-
-  @Inject
-  Locks(LockManager lockManager) {
-    this.lockManager = Objects.requireNonNull(lockManager);
-  }
-
-  /**
-   * Dumps existing locks.
-   *
-   * @return HTTP response.
-   */
-  @GET
-  @Produces(MediaType.APPLICATION_JSON)
-  public Response getLocks() {
-    return Response.ok(Maps.transformValues(
-        Maps.uniqueIndex(lockManager.getLocks(), TO_LOCK_KEY), TO_BEAN)).build();
-  }
-
-  private static final Function<ILock, String> TO_LOCK_KEY =
-      lock -> lock.getKey().getSetField() == LockKey._Fields.JOB
-          ? JobKeys.canonicalString(lock.getKey().getJob())
-          : "Unknown lock key type: " + lock.getKey().getSetField();
-
-  private static final Function<ILock, LockBean> TO_BEAN = LockBean::new;
-
-  private static final class LockBean {
-    private final ILock lock;
-
-    LockBean(ILock lock) {
-      this.lock = lock;
-    }
-
-    @JsonProperty("token")
-    public String getToken() {
-      return lock.getToken();
-    }
-
-    @JsonProperty("user")
-    public String getUser() {
-      return lock.getUser();
-    }
-
-    @JsonProperty("timestampMs")
-    public long getTimestampMs() {
-      return lock.getTimestampMs();
-    }
-
-    @JsonProperty("message")
-    public String getMessage() {
-      return lock.getMessage();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/main/java/org/apache/aurora/scheduler/state/LockManager.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/state/LockManager.java b/src/main/java/org/apache/aurora/scheduler/state/LockManager.java
index 07de8fc..2723306 100644
--- a/src/main/java/org/apache/aurora/scheduler/state/LockManager.java
+++ b/src/main/java/org/apache/aurora/scheduler/state/LockManager.java
@@ -13,8 +13,6 @@
  */
 package org.apache.aurora.scheduler.state;
 
-import java.util.Optional;
-
 import org.apache.aurora.scheduler.storage.entities.ILock;
 import org.apache.aurora.scheduler.storage.entities.ILockKey;
 
@@ -42,16 +40,12 @@ public interface LockManager {
   void releaseLock(ILock lock);
 
   /**
-   * Verifies if the provided lock instance is identical to the one stored in the scheduler
-   * ONLY if the operation context represented by the {@link ILockKey} is in fact locked.
-   * No validation will be performed in case there is no correspondent scheduler lock
-   * found for the provided context.
+   * Asserts that an entity is not locked.
    *
    * @param context Operation context to validate with the provided lock.
-   * @param heldLock Lock to validate.
-   * @throws LockException If provided lock does not exist or not identical to the stored one.
+   * @throws LockException If provided context is locked.
    */
-  void validateIfLocked(ILockKey context, Optional<ILock> heldLock) throws LockException;
+  void assertNotLocked(ILockKey context) throws LockException;
 
   /**
    * Returns all available locks stored.

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/main/java/org/apache/aurora/scheduler/state/LockManagerImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/state/LockManagerImpl.java b/src/main/java/org/apache/aurora/scheduler/state/LockManagerImpl.java
index 6da6c69..632d256 100644
--- a/src/main/java/org/apache/aurora/scheduler/state/LockManagerImpl.java
+++ b/src/main/java/org/apache/aurora/scheduler/state/LockManagerImpl.java
@@ -82,29 +82,13 @@ public class LockManagerImpl implements LockManager {
   }
 
   @Override
-  public void validateIfLocked(final ILockKey context, Optional<ILock> heldLock)
-      throws LockException {
-
+  public void assertNotLocked(final ILockKey context) throws LockException {
     Optional<ILock> stored = storage.read(
         storeProvider -> storeProvider.getLockStore().fetchLock(context));
-
-    // The implementation below assumes the following use cases:
-    // +-----------+-----------------+----------+
-    // |   eq      |     held        | not held |
-    // +-----------+-----------------+----------+
-    // |stored     |(stored == held)?| invalid  |
-    // +-----------+-----------------+----------+
-    // |not stored |    invalid      |  valid   |
-    // +-----------+-----------------+----------+
-    if (!stored.equals(heldLock)) {
-      if (stored.isPresent()) {
-        throw new LockException(String.format(
-            "Unable to perform operation for %s due to active lock held",
-            formatLockKey(context)));
-      } else if (heldLock.isPresent()) {
-        throw new LockException(
-            String.format("Invalid operation context: %s", formatLockKey(context)));
-      }
+    if (stored.isPresent()) {
+      throw new LockException(String.format(
+          "Unable to perform operation for %s due to active lock held",
+          formatLockKey(context)));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/main/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImpl.java b/src/main/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImpl.java
index 113af6a..bab34d8 100644
--- a/src/main/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImpl.java
+++ b/src/main/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImpl.java
@@ -48,7 +48,6 @@ import org.apache.aurora.gen.GetJobUpdateDetailsResult;
 import org.apache.aurora.gen.GetJobUpdateDiffResult;
 import org.apache.aurora.gen.GetJobUpdateSummariesResult;
 import org.apache.aurora.gen.GetJobsResult;
-import org.apache.aurora.gen.GetLocksResult;
 import org.apache.aurora.gen.GetPendingReasonResult;
 import org.apache.aurora.gen.GetQuotaResult;
 import org.apache.aurora.gen.JobConfiguration;
@@ -84,7 +83,6 @@ import org.apache.aurora.scheduler.filter.SchedulingFilter.Veto;
 import org.apache.aurora.scheduler.metadata.NearestFit;
 import org.apache.aurora.scheduler.quota.QuotaInfo;
 import org.apache.aurora.scheduler.quota.QuotaManager;
-import org.apache.aurora.scheduler.state.LockManager;
 import org.apache.aurora.scheduler.storage.Storage;
 import org.apache.aurora.scheduler.storage.entities.IAssignedTask;
 import org.apache.aurora.scheduler.storage.entities.IJobConfiguration;
@@ -94,7 +92,6 @@ import org.apache.aurora.scheduler.storage.entities.IJobUpdateKey;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateQuery;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateRequest;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateSummary;
-import org.apache.aurora.scheduler.storage.entities.ILock;
 import org.apache.aurora.scheduler.storage.entities.IRange;
 import org.apache.aurora.scheduler.storage.entities.IScheduledTask;
 import org.apache.aurora.scheduler.storage.entities.ITaskConfig;
@@ -121,7 +118,6 @@ class ReadOnlySchedulerImpl implements ReadOnlyScheduler.Iface {
   private final NearestFit nearestFit;
   private final CronPredictor cronPredictor;
   private final QuotaManager quotaManager;
-  private final LockManager lockManager;
 
   @Inject
   ReadOnlySchedulerImpl(
@@ -129,15 +125,13 @@ class ReadOnlySchedulerImpl implements ReadOnlyScheduler.Iface {
       Storage storage,
       NearestFit nearestFit,
       CronPredictor cronPredictor,
-      QuotaManager quotaManager,
-      LockManager lockManager) {
+      QuotaManager quotaManager) {
 
     this.configurationManager = requireNonNull(configurationManager);
     this.storage = requireNonNull(storage);
     this.nearestFit = requireNonNull(nearestFit);
     this.cronPredictor = requireNonNull(cronPredictor);
     this.quotaManager = requireNonNull(quotaManager);
-    this.lockManager = requireNonNull(lockManager);
   }
 
   @Override
@@ -299,12 +293,6 @@ class ReadOnlySchedulerImpl implements ReadOnlyScheduler.Iface {
   }
 
   @Override
-  public Response getLocks() {
-    return ok(Result.getLocksResult(
-        new GetLocksResult().setLocks(ILock.toBuildersSet(lockManager.getLocks()))));
-  }
-
-  @Override
   public Response getJobUpdateSummaries(JobUpdateQuery mutableQuery) {
     IJobUpdateQuery query = IJobUpdateQuery.build(requireNonNull(mutableQuery));
     return ok(Result.getJobUpdateSummariesResult(

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/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 7eda474..9e6ea3c 100644
--- a/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
+++ b/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
@@ -35,7 +35,6 @@ import com.google.common.collect.Multimap;
 import com.google.common.collect.Multimaps;
 import com.google.common.collect.Range;
 
-import org.apache.aurora.gen.AcquireLockResult;
 import org.apache.aurora.gen.AddInstancesConfig;
 import org.apache.aurora.gen.ConfigRewrite;
 import org.apache.aurora.gen.DrainHostsResult;
@@ -54,9 +53,7 @@ import org.apache.aurora.gen.JobUpdateRequest;
 import org.apache.aurora.gen.JobUpdateSettings;
 import org.apache.aurora.gen.JobUpdateSummary;
 import org.apache.aurora.gen.ListBackupsResult;
-import org.apache.aurora.gen.Lock;
 import org.apache.aurora.gen.LockKey;
-import org.apache.aurora.gen.LockValidation;
 import org.apache.aurora.gen.MaintenanceStatusResult;
 import org.apache.aurora.gen.PulseJobUpdateResult;
 import org.apache.aurora.gen.QueryRecoveryResult;
@@ -108,7 +105,6 @@ import org.apache.aurora.scheduler.storage.entities.IJobUpdate;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateKey;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateRequest;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateSettings;
-import org.apache.aurora.scheduler.storage.entities.ILock;
 import org.apache.aurora.scheduler.storage.entities.ILockKey;
 import org.apache.aurora.scheduler.storage.entities.IRange;
 import org.apache.aurora.scheduler.storage.entities.IResourceAggregate;
@@ -212,7 +208,7 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
   }
 
   @Override
-  public Response createJob(JobConfiguration mutableJob, @Nullable Lock mutableLock) {
+  public Response createJob(JobConfiguration mutableJob) {
     SanitizedConfiguration sanitized;
     try {
       sanitized = SanitizedConfiguration.fromUnsanitized(
@@ -230,9 +226,7 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
       IJobConfiguration job = sanitized.getJobConfig();
 
       try {
-        lockManager.validateIfLocked(
-            ILockKey.build(LockKey.job(job.getKey().newBuilder())),
-            java.util.Optional.ofNullable(mutableLock).map(ILock::build));
+        lockManager.assertNotLocked(ILockKey.build(LockKey.job(job.getKey().newBuilder())));
 
         checkJobExists(storeProvider, job.getKey());
 
@@ -275,7 +269,6 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
 
   private Response createOrUpdateCronTemplate(
       JobConfiguration mutableJob,
-      @Nullable Lock mutableLock,
       boolean updateOnly) {
 
     IJobConfiguration job = IJobConfiguration.build(mutableJob);
@@ -294,9 +287,7 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
 
     return storage.write(storeProvider -> {
       try {
-        lockManager.validateIfLocked(
-            ILockKey.build(LockKey.job(jobKey.newBuilder())),
-            java.util.Optional.ofNullable(mutableLock).map(ILock::build));
+        lockManager.assertNotLocked(ILockKey.build(LockKey.job(jobKey.newBuilder())));
 
         ITaskConfig template = sanitized.getJobConfig().getTaskConfig();
         int count = sanitized.getJobConfig().getInstanceCount();
@@ -325,22 +316,20 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
   }
 
   @Override
-  public Response scheduleCronJob(JobConfiguration mutableJob, @Nullable Lock mutableLock) {
-    return createOrUpdateCronTemplate(mutableJob, mutableLock, false);
+  public Response scheduleCronJob(JobConfiguration mutableJob) {
+    return createOrUpdateCronTemplate(mutableJob, false);
   }
 
   @Override
-  public Response replaceCronTemplate(JobConfiguration mutableJob, @Nullable Lock mutableLock) {
-    return createOrUpdateCronTemplate(mutableJob, mutableLock, true);
+  public Response replaceCronTemplate(JobConfiguration mutableJob) {
+    return createOrUpdateCronTemplate(mutableJob, true);
   }
 
   @Override
-  public Response descheduleCronJob(JobKey mutableJobKey, @Nullable Lock mutableLock) {
+  public Response descheduleCronJob(JobKey mutableJobKey) {
     try {
       IJobKey jobKey = JobKeys.assertValid(IJobKey.build(mutableJobKey));
-      lockManager.validateIfLocked(
-          ILockKey.build(LockKey.job(jobKey.newBuilder())),
-          java.util.Optional.ofNullable(mutableLock).map(ILock::build));
+      lockManager.assertNotLocked(ILockKey.build(LockKey.job(jobKey.newBuilder())));
 
       if (cronJobManager.deleteJob(jobKey)) {
         return ok();
@@ -410,16 +399,14 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
     return readOnlyScheduler.getJobUpdateDiff(request);
   }
 
-  private void validateLockForTasks(java.util.Optional<ILock> lock, Iterable<IScheduledTask> tasks)
-      throws LockException {
-
+  private void validateLockForTasks(Iterable<IScheduledTask> tasks) throws LockException {
     ImmutableSet<IJobKey> uniqueKeys = FluentIterable.from(tasks)
         .transform(Tasks::getJob)
         .toSet();
 
     // Validate lock against every unique job key derived from the tasks.
     for (IJobKey key : uniqueKeys) {
-      lockManager.validateIfLocked(ILockKey.build(LockKey.job(key.newBuilder())), lock);
+      lockManager.assertNotLocked(ILockKey.build(LockKey.job(key.newBuilder())));
     }
   }
 
@@ -431,7 +418,6 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
   @Override
   public Response killTasks(
       @Nullable TaskQuery mutableQuery,
-      @Nullable Lock mutableLock,
       @Nullable JobKey mutableJob,
       @Nullable Set<Integer> instances) {
 
@@ -458,9 +444,7 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
     return storage.write(storeProvider -> {
       Iterable<IScheduledTask> tasks = storeProvider.getTaskStore().fetchTasks(query);
       try {
-        validateLockForTasks(
-            java.util.Optional.ofNullable(mutableLock).map(ILock::build),
-            tasks);
+        validateLockForTasks(tasks);
       } catch (LockException e) {
         return error(LOCK_ERROR, e);
       }
@@ -484,19 +468,13 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
   }
 
   @Override
-  public Response restartShards(
-      JobKey mutableJobKey,
-      Set<Integer> shardIds,
-      @Nullable Lock mutableLock) {
-
+  public Response restartShards(JobKey mutableJobKey, Set<Integer> shardIds) {
     IJobKey jobKey = JobKeys.assertValid(IJobKey.build(mutableJobKey));
     checkNotBlank(shardIds);
 
     return storage.write(storeProvider -> {
       try {
-        lockManager.validateIfLocked(
-            ILockKey.build(LockKey.job(jobKey.newBuilder())),
-            java.util.Optional.ofNullable(mutableLock).map(ILock::build));
+        lockManager.assertNotLocked(ILockKey.build(LockKey.job(jobKey.newBuilder())));
       } catch (LockException e) {
         return error(LOCK_ERROR, e);
       }
@@ -751,7 +729,6 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
   @Override
   public Response addInstances(
       @Nullable AddInstancesConfig config,
-      @Nullable Lock mutableLock,
       @Nullable InstanceKey key,
       int count) {
 
@@ -765,9 +742,7 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
           return invalidRequest("Instances may not be added to cron jobs.");
         }
 
-        lockManager.validateIfLocked(
-            ILockKey.build(LockKey.job(jobKey.newBuilder())),
-            java.util.Optional.ofNullable(mutableLock).map(ILock::build));
+        lockManager.assertNotLocked(ILockKey.build(LockKey.job(jobKey.newBuilder())));
 
         FluentIterable<IScheduledTask> currentTasks = FluentIterable.from(
             storeProvider.getTaskStore().fetchTasks(Query.jobScoped(jobKey).active()));
@@ -826,44 +801,6 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
     return storeProvider.getCronJobStore().fetchJob(jobKey);
   }
 
-  @Override
-  public Response acquireLock(LockKey mutableLockKey) {
-    requireNonNull(mutableLockKey);
-
-    ILockKey lockKey = ILockKey.build(mutableLockKey);
-
-    try {
-      ILock lock = lockManager.acquireLock(lockKey, auditMessages.getRemoteUserName());
-      return ok(Result.acquireLockResult(
-          new AcquireLockResult().setLock(lock.newBuilder())));
-    } catch (LockException e) {
-      return error(LOCK_ERROR, e);
-    }
-  }
-
-  @Override
-  public Response releaseLock(Lock mutableLock, LockValidation validation) {
-    requireNonNull(mutableLock);
-    requireNonNull(validation);
-
-    ILock lock = ILock.build(mutableLock);
-
-    try {
-      if (validation == LockValidation.CHECKED) {
-        lockManager.validateIfLocked(lock.getKey(), java.util.Optional.of(lock));
-      }
-      lockManager.releaseLock(lock);
-      return ok();
-    } catch (LockException e) {
-      return error(LOCK_ERROR, e);
-    }
-  }
-
-  @Override
-  public Response getLocks() throws TException {
-    return readOnlyScheduler.getLocks();
-  }
-
   private static class TaskValidationException extends Exception {
     TaskValidationException(String message) {
       super(message);

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/main/java/org/apache/aurora/scheduler/thrift/aop/AnnotatedAuroraAdmin.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/thrift/aop/AnnotatedAuroraAdmin.java b/src/main/java/org/apache/aurora/scheduler/thrift/aop/AnnotatedAuroraAdmin.java
index f2f69f9..f295992 100644
--- a/src/main/java/org/apache/aurora/scheduler/thrift/aop/AnnotatedAuroraAdmin.java
+++ b/src/main/java/org/apache/aurora/scheduler/thrift/aop/AnnotatedAuroraAdmin.java
@@ -24,9 +24,6 @@ import org.apache.aurora.gen.JobConfiguration;
 import org.apache.aurora.gen.JobKey;
 import org.apache.aurora.gen.JobUpdateKey;
 import org.apache.aurora.gen.JobUpdateRequest;
-import org.apache.aurora.gen.Lock;
-import org.apache.aurora.gen.LockKey;
-import org.apache.aurora.gen.LockValidation;
 import org.apache.aurora.gen.Response;
 import org.apache.aurora.gen.TaskQuery;
 import org.apache.aurora.scheduler.http.api.security.AuthorizingParam;
@@ -45,19 +42,14 @@ import org.apache.thrift.TException;
  */
 public interface AnnotatedAuroraAdmin extends AuroraAdmin.Iface {
   @Override
-  Response createJob(
-      @AuthorizingParam @Nullable JobConfiguration description,
-      @Nullable Lock lock) throws TException;
+  Response createJob(@AuthorizingParam @Nullable JobConfiguration description) throws TException;
 
   @Override
   Response scheduleCronJob(
-      @AuthorizingParam @Nullable JobConfiguration description,
-      @Nullable Lock lock) throws TException;
+      @AuthorizingParam @Nullable JobConfiguration description) throws TException;
 
   @Override
-  Response descheduleCronJob(
-      @AuthorizingParam @Nullable JobKey job,
-      @Nullable Lock lock) throws TException;
+  Response descheduleCronJob(@AuthorizingParam @Nullable JobKey job) throws TException;
 
   @Override
   Response startCronJob(
@@ -66,36 +58,23 @@ public interface AnnotatedAuroraAdmin extends AuroraAdmin.Iface {
   @Override
   Response restartShards(
       @AuthorizingParam @Nullable JobKey job,
-      @Nullable Set<Integer> shardIds,
-      @Nullable Lock lock) throws TException;
+      @Nullable Set<Integer> shardIds) throws TException;
 
   @Override
   Response killTasks(
       @AuthorizingParam @Nullable TaskQuery query,
-      @Nullable Lock lock,
       @AuthorizingParam @Nullable JobKey job,
       @Nullable Set<Integer> instances) throws TException;
 
   @Override
   Response addInstances(
       @AuthorizingParam @Nullable AddInstancesConfig config,
-      @Nullable Lock lock,
       @AuthorizingParam @Nullable InstanceKey key,
       int count) throws TException;
 
   @Override
-  Response acquireLock(
-      @AuthorizingParam @Nullable LockKey lockKey) throws TException;
-
-  @Override
-  Response releaseLock(
-      @AuthorizingParam @Nullable Lock lock,
-      @Nullable LockValidation validation) throws TException;
-
-  @Override
   Response replaceCronTemplate(
-      @AuthorizingParam @Nullable JobConfiguration config,
-      @Nullable Lock lock) throws TException;
+      @AuthorizingParam @Nullable JobConfiguration config) throws TException;
 
   @Override
   Response startJobUpdate(

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/main/python/apache/aurora/admin/admin.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/admin/admin.py b/src/main/python/apache/aurora/admin/admin.py
index 62a2302..e309460 100644
--- a/src/main/python/apache/aurora/admin/admin.py
+++ b/src/main/python/apache/aurora/admin/admin.py
@@ -16,7 +16,6 @@ from __future__ import print_function
 
 import json
 import optparse
-import pprint
 import sys
 
 from twitter.common import app, log
@@ -328,23 +327,6 @@ def scheduler_snapshot(cluster):
 
 
 @app.command
-@requires.exactly('cluster')
-def get_locks(cluster):
-  """usage: get_locks cluster
-
-  Prints all context/operation locks in the scheduler.
-  """
-  resp = make_admin_client(cluster).get_locks()
-  check_and_log_response(resp)
-
-  pp = pprint.PrettyPrinter(indent=2)
-  def pretty_print_lock(lock):
-    return pp.pformat(vars(lock))
-
-  print_results([',\n'.join(pretty_print_lock(t) for t in resp.result.getLocksResult.locks)])
-
-
-@app.command
 @app.command_option('-X', '--exclude_file', dest='exclude_filename', default=None,
     help='Exclusion filter. An optional text file listing host names (one per line)'
          'to exclude from the result set if found.')

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/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 c5469bd..18a10e2 100644
--- a/src/main/python/apache/aurora/client/api/__init__.py
+++ b/src/main/python/apache/aurora/client/api/__init__.py
@@ -31,7 +31,6 @@ from gen.apache.aurora.api.ttypes import (
     JobUpdateKey,
     JobUpdateQuery,
     JobUpdateRequest,
-    Lock,
     ResourceAggregate,
     TaskQuery
 )
@@ -71,21 +70,19 @@ class AuroraClientAPI(object):
   def scheduler_proxy(self):
     return self._scheduler_proxy
 
-  def create_job(self, config, lock=None):
+  def create_job(self, config):
     log.info('Creating job %s' % config.name())
     log.debug('Full configuration: %s' % config.job())
-    log.debug('Lock %s' % lock)
-    return self._scheduler_proxy.createJob(config.job(), lock)
+    return self._scheduler_proxy.createJob(config.job())
 
-  def schedule_cron(self, config, lock=None):
+  def schedule_cron(self, config):
     log.info("Registering job %s with cron" % config.name())
     log.debug('Full configuration: %s' % config.job())
-    log.debug('Lock %s' % lock)
-    return self._scheduler_proxy.scheduleCronJob(config.job(), lock)
+    return self._scheduler_proxy.scheduleCronJob(config.job())
 
-  def deschedule_cron(self, jobkey, lock=None):
+  def deschedule_cron(self, jobkey):
     log.info("Removing cron schedule for job %s" % jobkey)
-    return self._scheduler_proxy.descheduleCronJob(jobkey.to_thrift(), lock)
+    return self._scheduler_proxy.descheduleCronJob(jobkey.to_thrift())
 
   def populate_job_config(self, config):
     return self._scheduler_proxy.populateJobConfig(config.job())
@@ -104,9 +101,9 @@ class AuroraClientAPI(object):
     key = InstanceKey(jobKey=job_key.to_thrift(), instanceId=instance_id)
     log.info("Adding %s instances to %s using the task config of instance %s"
              % (count, job_key, instance_id))
-    return self._scheduler_proxy.addInstances(None, None, key, count)
+    return self._scheduler_proxy.addInstances(None, key, count)
 
-  def kill_job(self, job_key, instances=None, lock=None):
+  def kill_job(self, job_key, instances=None):
     log.info("Killing tasks for job: %s" % job_key)
     self._assert_valid_job_key(job_key)
 
@@ -114,7 +111,7 @@ class AuroraClientAPI(object):
       log.info("Instances to be killed: %s" % instances)
       instances = frozenset([int(s) for s in instances])
 
-    return self._scheduler_proxy.killTasks(None, lock, job_key.to_thrift(), instances)
+    return self._scheduler_proxy.killTasks(None, job_key.to_thrift(), instances)
 
   def check_status(self, job_key):
     self._assert_valid_job_key(job_key)
@@ -322,9 +319,6 @@ class AuroraClientAPI(object):
   def unsafe_rewrite_config(self, rewrite_request):
     return self._scheduler_proxy.rewriteConfigs(rewrite_request)
 
-  def get_locks(self):
-    return self._scheduler_proxy.getLocks()
-
   def sla_get_job_uptime_vector(self, job_key):
     self._assert_valid_job_key(job_key)
     return Sla(self._scheduler_proxy).get_job_uptime_vector(job_key)
@@ -335,11 +329,6 @@ class AuroraClientAPI(object):
         min_instance_count,
         hosts)
 
-  def _assert_valid_lock(self, lock):
-    if not isinstance(lock, Lock):
-      raise TypeError('Invalid lock %r: expected %s but got %s'
-          % (lock, AuroraJobKey.__name__, lock.__class__.__name__))
-
   def _assert_valid_job_key(self, job_key):
     if not isinstance(job_key, AuroraJobKey):
       raise TypeError('Invalid job_key %r: expected %s but got %s'

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/main/python/apache/aurora/client/api/restarter.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/restarter.py b/src/main/python/apache/aurora/client/api/restarter.py
index cd63311..fbe8f20 100644
--- a/src/main/python/apache/aurora/client/api/restarter.py
+++ b/src/main/python/apache/aurora/client/api/restarter.py
@@ -48,12 +48,10 @@ class Restarter(object):
                job_key,
                restart_settings,
                scheduler,
-               instance_watcher=None,
-               lock=None):
+               instance_watcher=None):
     self._job_key = job_key
     self._restart_settings = restart_settings
     self._scheduler = scheduler
-    self._lock = lock
     self._instance_watcher = instance_watcher or InstanceWatcher(
         scheduler,
         job_key.to_thrift(),
@@ -90,7 +88,7 @@ class Restarter(object):
 
       log.info("Restarting instances: %s", batch)
 
-      resp = self._scheduler.restartShards(self._job_key.to_thrift(), batch, self._lock)
+      resp = self._scheduler.restartShards(self._job_key.to_thrift(), batch)
       if resp.responseCode != ResponseCode.OK:
         log.error('Error restarting instances: %s', combine_messages(resp))
         return resp

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/main/python/apache/aurora/client/hooks/hooked_api.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/hooks/hooked_api.py b/src/main/python/apache/aurora/client/hooks/hooked_api.py
index 300071f..542f165 100644
--- a/src/main/python/apache/aurora/client/hooks/hooked_api.py
+++ b/src/main/python/apache/aurora/client/hooks/hooked_api.py
@@ -52,8 +52,8 @@ class NonHookedAuroraClientAPI(AuroraClientAPI):
   def add_instances(self, job_key, instance_id, count, config=None):
     return super(NonHookedAuroraClientAPI, self).add_instances(job_key, instance_id, count)
 
-  def kill_job(self, job_key, instances=None, lock=None, config=None):
-    return super(NonHookedAuroraClientAPI, self).kill_job(job_key, instances=instances, lock=lock)
+  def kill_job(self, job_key, instances=None, config=None):
+    return super(NonHookedAuroraClientAPI, self).kill_job(job_key, instances=instances)
 
   def restart(self, job_key, shards, restart_settings, config=None):
     return super(NonHookedAuroraClientAPI, self).restart(job_key, shards, restart_settings)
@@ -153,19 +153,19 @@ class HookedAuroraClientAPI(NonHookedAuroraClientAPI):
 
     return resp
 
-  def create_job(self, config, lock=None):
+  def create_job(self, config):
     return self._hooked_call(config, None,
-        _partial(super(HookedAuroraClientAPI, self).create_job, config, lock))
+        _partial(super(HookedAuroraClientAPI, self).create_job, config))
 
   def add_instances(self, job_key, instance_id, count, config=None):
     return self._hooked_call(config, job_key,
         _partial(super(HookedAuroraClientAPI, self).add_instances,
             job_key, instance_id, count, config=config))
 
-  def kill_job(self, job_key, instances=None, lock=None, config=None):
+  def kill_job(self, job_key, instances=None, config=None):
     return self._hooked_call(config, job_key,
         _partial(super(HookedAuroraClientAPI, self).kill_job,
-            job_key, instances=instances, lock=lock, config=config))
+            job_key, instances=instances, config=config))
 
   def restart(self, job_key, shards, restart_settings, config=None):
     return self._hooked_call(config, job_key,

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/test/java/org/apache/aurora/scheduler/http/LocksTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/LocksTest.java b/src/test/java/org/apache/aurora/scheduler/http/LocksTest.java
deleted file mode 100644
index 94c3c29..0000000
--- a/src/test/java/org/apache/aurora/scheduler/http/LocksTest.java
+++ /dev/null
@@ -1,84 +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.
- */
-package org.apache.aurora.scheduler.http;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.Response;
-
-import com.google.common.collect.ImmutableSet;
-
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.gen.Lock;
-import org.apache.aurora.gen.LockKey;
-import org.apache.aurora.scheduler.base.JobKeys;
-import org.apache.aurora.scheduler.state.LockManager;
-import org.apache.aurora.scheduler.storage.entities.IJobKey;
-import org.apache.aurora.scheduler.storage.entities.ILock;
-import org.apache.aurora.scheduler.storage.entities.ILockKey;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class LocksTest extends EasyMockTest {
-  private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
-  private static final IJobKey JOB_KEY = JobKeys.from("role", "env", "job");
-  private static final ILockKey LOCK_KEY = ILockKey.build(LockKey.job(JOB_KEY.newBuilder()));
-
-  private Locks locks;
-  private LockManager lockManager;
-
-  @Before
-  public void setUp() {
-    lockManager = createMock(LockManager.class);
-    locks = new Locks(lockManager);
-  }
-
-  @Test
-  public void testDumpContents() throws Exception {
-    ILock lock = ILock.build(new Lock()
-        .setKey(LOCK_KEY.newBuilder())
-        .setToken("test token")
-        .setMessage("test msg")
-        .setUser("test usr")
-        .setTimestampMs(325));
-    expect(lockManager.getLocks()).andReturn(ImmutableSet.of(lock));
-
-    control.replay();
-
-    Response response = locks.getLocks();
-    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
-
-    String result = OBJECT_MAPPER.writeValueAsString(response.getEntity());
-    assertTrue(result.contains("role/env/job"));
-    assertTrue(result.contains("test token"));
-    assertTrue(result.contains("test msg"));
-    assertTrue(result.contains("test usr"));
-    assertTrue(result.contains("325"));
-  }
-
-  @Test
-  public void testDumpEmptyContents() throws Exception {
-    expect(lockManager.getLocks()).andReturn(ImmutableSet.of());
-
-    control.replay();
-
-    Response response = locks.getLocks();
-    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
-    assertEquals("{}", OBJECT_MAPPER.writeValueAsString(response.getEntity()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java b/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
index f14d405..ccef4ab 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
@@ -33,8 +33,6 @@ import org.apache.aurora.gen.JobConfiguration;
 import org.apache.aurora.gen.JobKey;
 import org.apache.aurora.gen.JobSummary;
 import org.apache.aurora.gen.JobSummaryResult;
-import org.apache.aurora.gen.Lock;
-import org.apache.aurora.gen.LockKey;
 import org.apache.aurora.gen.Response;
 import org.apache.aurora.gen.Result;
 import org.apache.aurora.gen.RoleSummary;
@@ -54,7 +52,6 @@ import org.junit.Test;
 import static org.apache.aurora.gen.ResponseCode.OK;
 import static org.apache.aurora.gen.ScheduleStatus.RUNNING;
 import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expect;
 import static org.junit.Assert.assertEquals;
 
@@ -88,20 +85,17 @@ public class ApiBetaTest extends AbstractJettyTest {
 
   @Test
   public void testCreateJob() throws Exception {
-    Lock lock = new Lock()
-        .setKey(LockKey.job(new JobKey("role", "env", "name")))
-        .setToken("token");
     Response response = new Response()
         .setResponseCode(OK);
 
     JobConfiguration job = JOB_CONFIG.newBuilder();
-    expect(thrift.createJob(anyObject(), eq(lock))).andReturn(response);
+    expect(thrift.createJob(anyObject())).andReturn(response);
 
     replayAndStart();
 
     Response actualResponse = getRequestBuilder("/apibeta/createJob")
         .entity(
-            ImmutableMap.of("description", job, "lock", lock),
+            ImmutableMap.of("description", job),
             MediaType.APPLICATION_JSON)
         .post(Response.class);
     assertEquals(IResponse.build(response), IResponse.build(actualResponse));

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java b/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
index dbec26f..9031217 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
@@ -35,7 +35,6 @@ import com.sun.jersey.api.client.ClientResponse;
 
 import org.apache.aurora.gen.AuroraAdmin;
 import org.apache.aurora.gen.JobKey;
-import org.apache.aurora.gen.Lock;
 import org.apache.aurora.gen.Response;
 import org.apache.aurora.gen.ResponseCode;
 import org.apache.aurora.scheduler.base.JobKeys;
@@ -228,7 +227,7 @@ public class HttpSecurityIT extends AbstractJettyTest {
 
   private void assertKillTasksFails(AuroraAdmin.Client client) throws TException {
     try {
-      client.killTasks(null, null, null, null);
+      client.killTasks(null, null, null);
       fail("killTasks should fail.");
     } catch (TTransportException e) {
       // Expected.
@@ -237,14 +236,14 @@ public class HttpSecurityIT extends AbstractJettyTest {
 
   @Test
   public void testAuroraSchedulerManager() throws TException, ServletException, IOException {
-    expect(auroraAdmin.killTasks(null, new Lock().setMessage("1"), null, null)).andReturn(OK);
-    expect(auroraAdmin.killTasks(null, new Lock().setMessage("2"), null, null)).andReturn(OK);
+    expect(auroraAdmin.killTasks(null, null, null)).andReturn(OK);
+    expect(auroraAdmin.killTasks(null, null, null)).andReturn(OK);
 
     JobKey job = JobKeys.from("role", "env", "name").newBuilder();
     ITaskQuery jobScopedQuery = Query.jobScoped(IJobKey.build(job)).get();
     ITaskQuery adsScopedQuery = Query.jobScoped(ADS_STAGING_JOB).get();
-    expect(auroraAdmin.killTasks(adsScopedQuery.newBuilder(), null, null, null)).andReturn(OK);
-    expect(auroraAdmin.killTasks(null, null, ADS_STAGING_JOB.newBuilder(), null)).andReturn(OK);
+    expect(auroraAdmin.killTasks(adsScopedQuery.newBuilder(), null, null)).andReturn(OK);
+    expect(auroraAdmin.killTasks(null, ADS_STAGING_JOB.newBuilder(), null)).andReturn(OK);
 
     expectShiroAfterAuthFilter().times(24);
 
@@ -252,56 +251,55 @@ public class HttpSecurityIT extends AbstractJettyTest {
 
     assertEquals(
         OK,
-        getAuthenticatedClient(WFARNER).killTasks(null, new Lock().setMessage("1"), null, null));
+        getAuthenticatedClient(WFARNER).killTasks(null, null, null));
     assertEquals(
         OK,
-        getAuthenticatedClient(ROOT).killTasks(null, new Lock().setMessage("2"), null, null));
+        getAuthenticatedClient(ROOT).killTasks(null, null, null));
 
     assertEquals(
         ResponseCode.INVALID_REQUEST,
-        getAuthenticatedClient(UNPRIVILEGED).killTasks(null, null, null, null).getResponseCode());
+        getAuthenticatedClient(UNPRIVILEGED).killTasks(null, null, null).getResponseCode());
     assertEquals(
         ResponseCode.AUTH_FAILED,
         getAuthenticatedClient(UNPRIVILEGED)
-            .killTasks(jobScopedQuery.newBuilder(), null, null, null)
+            .killTasks(jobScopedQuery.newBuilder(), null, null)
             .getResponseCode());
     assertEquals(
         ResponseCode.AUTH_FAILED,
         getAuthenticatedClient(UNPRIVILEGED)
-            .killTasks(null, null, job, null)
+            .killTasks(null, job, null)
             .getResponseCode());
     assertEquals(
         ResponseCode.INVALID_REQUEST,
-        getAuthenticatedClient(BACKUP_SERVICE).killTasks(null, null, null, null).getResponseCode());
+        getAuthenticatedClient(BACKUP_SERVICE).killTasks(null, null, null).getResponseCode());
     assertEquals(
         ResponseCode.AUTH_FAILED,
         getAuthenticatedClient(BACKUP_SERVICE)
-            .killTasks(jobScopedQuery.newBuilder(), null, null, null)
+            .killTasks(jobScopedQuery.newBuilder(), null, null)
             .getResponseCode());
     assertEquals(
         ResponseCode.AUTH_FAILED,
         getAuthenticatedClient(BACKUP_SERVICE)
-            .killTasks(null, null, job, null)
+            .killTasks(null, job, null)
             .getResponseCode());
     assertEquals(
         ResponseCode.AUTH_FAILED,
         getAuthenticatedClient(DEPLOY_SERVICE)
-            .killTasks(jobScopedQuery.newBuilder(), null, null, null)
+            .killTasks(jobScopedQuery.newBuilder(), null, null)
             .getResponseCode());
     assertEquals(
         ResponseCode.AUTH_FAILED,
         getAuthenticatedClient(DEPLOY_SERVICE)
-            .killTasks(null, null, job, null)
+            .killTasks(null, job, null)
             .getResponseCode());
     assertEquals(
         OK,
         getAuthenticatedClient(DEPLOY_SERVICE)
-            .killTasks(adsScopedQuery.newBuilder(), null, null, null));
+            .killTasks(adsScopedQuery.newBuilder(), null, null));
     assertEquals(
         OK,
         getAuthenticatedClient(DEPLOY_SERVICE).killTasks(
             null,
-            null,
             ADS_STAGING_JOB.newBuilder(),
             null));
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroAuthorizingParamInterceptorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroAuthorizingParamInterceptorTest.java b/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroAuthorizingParamInterceptorTest.java
index a704730..503f0c3 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroAuthorizingParamInterceptorTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroAuthorizingParamInterceptorTest.java
@@ -115,12 +115,11 @@ public class ShiroAuthorizingParamInterceptorTest extends EasyMockTest {
     expect(subject
         .isPermitted(interceptor.makeTargetPermission("createJob", JOB_KEY)))
         .andReturn(true);
-    expect(thrift.createJob(jobConfiguration, null))
-        .andReturn(response);
+    expect(thrift.createJob(jobConfiguration)).andReturn(response);
 
     replayAndInitialize();
 
-    assertSame(response, decoratedThrift.createJob(jobConfiguration, null));
+    assertSame(response, decoratedThrift.createJob(jobConfiguration));
   }
 
   @Test
@@ -131,12 +130,12 @@ public class ShiroAuthorizingParamInterceptorTest extends EasyMockTest {
     // AURORA-1592.
     expect(subject.isPermitted(interceptor.makeWildcardPermission("killTasks")))
         .andReturn(true);
-    expect(thrift.killTasks(new TaskQuery(), null, null, null))
+    expect(thrift.killTasks(new TaskQuery(), null, null))
         .andReturn(response);
 
     replayAndInitialize();
 
-    assertSame(response, decoratedThrift.killTasks(new TaskQuery(), null, null, null));
+    assertSame(response, decoratedThrift.killTasks(new TaskQuery(), null, null));
   }
 
   @Test
@@ -151,7 +150,7 @@ public class ShiroAuthorizingParamInterceptorTest extends EasyMockTest {
 
     assertEquals(
         ResponseCode.AUTH_FAILED,
-        decoratedThrift.killTasks(null, null, JOB_KEY.newBuilder(), null).getResponseCode());
+        decoratedThrift.killTasks(null, JOB_KEY.newBuilder(), null).getResponseCode());
   }
 
   @Test
@@ -165,7 +164,6 @@ public class ShiroAuthorizingParamInterceptorTest extends EasyMockTest {
         ResponseCode.INVALID_REQUEST,
         decoratedThrift.killTasks(
             null,
-            null,
             JOB_KEY.newBuilder().setName(null),
             null).getResponseCode());
   }

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/test/java/org/apache/aurora/scheduler/state/LockManagerImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/state/LockManagerImplTest.java b/src/test/java/org/apache/aurora/scheduler/state/LockManagerImplTest.java
index a146e40..19f9de3 100644
--- a/src/test/java/org/apache/aurora/scheduler/state/LockManagerImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/state/LockManagerImplTest.java
@@ -106,51 +106,6 @@ public class LockManagerImplTest extends EasyMockTest {
   }
 
   @Test
-  public void testValidateLockStoredEqualHeld() throws Exception {
-    control.replay();
-
-    ILock lock = lockManager.acquireLock(LOCK_KEY, USER);
-    lockManager.validateIfLocked(LOCK_KEY, Optional.of(lock));
-  }
-
-  @Test
-  public void testValidateLockNotStoredNotHeld() throws Exception {
-    control.replay();
-
-    lockManager.validateIfLocked(LOCK_KEY, Optional.empty());
-  }
-
-  @Test
-  public void testValidateLockStoredNotEqualHeld() throws Exception {
-    control.replay();
-
-    expectLockException(JOB_KEY);
-    ILock lock = lockManager.acquireLock(LOCK_KEY, USER);
-    lock = ILock.build(lock.newBuilder().setUser("bob"));
-    lockManager.validateIfLocked(LOCK_KEY, Optional.of(lock));
-  }
-
-  @Test
-  public void testValidateLockStoredNotEqualHeldWithHeldNull() throws Exception {
-    control.replay();
-
-    expectLockException(JOB_KEY);
-    lockManager.acquireLock(LOCK_KEY, USER);
-    lockManager.validateIfLocked(LOCK_KEY, Optional.empty());
-  }
-
-  @Test
-  public void testValidateLockNotStoredHeld() throws Exception {
-    control.replay();
-
-    IJobKey jobKey = JobKeys.from("r", "e", "n");
-    expectLockException(jobKey);
-    ILock lock = lockManager.acquireLock(LOCK_KEY, USER);
-    ILockKey key = ILockKey.build(LockKey.job(jobKey.newBuilder()));
-    lockManager.validateIfLocked(key, Optional.of(lock));
-  }
-
-  @Test
   public void testGetLocks() throws Exception {
     control.replay();
 
@@ -190,14 +145,14 @@ public class LockManagerImplTest extends EasyMockTest {
         .build()
         .newThread(() -> {
           try {
-            lockManager.validateIfLocked(LOCK_KEY, Optional.empty());
+            lockManager.assertNotLocked(LOCK_KEY);
           } catch (LockException e) {
             throw Throwables.propagate(e);
           }
         })
         .start();
 
-    lockManager.validateIfLocked(LOCK_KEY, Optional.empty());
+    lockManager.assertNotLocked(LOCK_KEY);
   }
 
   private void expectLockException(IJobKey key) {

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/test/java/org/apache/aurora/scheduler/thrift/Fixtures.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/Fixtures.java b/src/test/java/org/apache/aurora/scheduler/thrift/Fixtures.java
index be98f38..fd6a40c 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/Fixtures.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/Fixtures.java
@@ -34,7 +34,6 @@ import org.apache.aurora.gen.JobConfiguration;
 import org.apache.aurora.gen.JobSummary;
 import org.apache.aurora.gen.JobSummaryResult;
 import org.apache.aurora.gen.JobUpdateKey;
-import org.apache.aurora.gen.Lock;
 import org.apache.aurora.gen.LockKey;
 import org.apache.aurora.gen.MesosContainer;
 import org.apache.aurora.gen.ResourceAggregate;
@@ -48,7 +47,6 @@ import org.apache.aurora.scheduler.base.JobKeys;
 import org.apache.aurora.scheduler.quota.QuotaCheckResult;
 import org.apache.aurora.scheduler.storage.entities.IJobKey;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateKey;
-import org.apache.aurora.scheduler.storage.entities.ILock;
 import org.apache.aurora.scheduler.storage.entities.ILockKey;
 import org.apache.aurora.scheduler.storage.entities.IResourceAggregate;
 import org.apache.aurora.scheduler.storage.entities.IResult;
@@ -66,8 +64,6 @@ final class Fixtures {
   static final String JOB_NAME = "job_foo";
   static final IJobKey JOB_KEY = JobKeys.from(ROLE, "devel", JOB_NAME);
   static final ILockKey LOCK_KEY = ILockKey.build(LockKey.job(JOB_KEY.newBuilder()));
-  static final ILock LOCK =
-      ILock.build(new Lock().setKey(LOCK_KEY.newBuilder()).setToken("token"));
   static final JobConfiguration CRON_JOB = makeJob().setCronSchedule("* * * * *");
   static final String TASK_ID = "task_id";
   static final String UPDATE_ID = "82d6d790-3212-11e3-aa6e-0800200c9a74";

http://git-wip-us.apache.org/repos/asf/aurora/blob/a9b3df88/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java b/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
index fcb5c22..c3240cd 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
@@ -74,7 +74,6 @@ import org.apache.aurora.scheduler.filter.SchedulingFilter.Veto;
 import org.apache.aurora.scheduler.metadata.NearestFit;
 import org.apache.aurora.scheduler.quota.QuotaInfo;
 import org.apache.aurora.scheduler.quota.QuotaManager;
-import org.apache.aurora.scheduler.state.LockManager;
 import org.apache.aurora.scheduler.storage.entities.IConfigSummaryResult;
 import org.apache.aurora.scheduler.storage.entities.IJobConfiguration;
 import org.apache.aurora.scheduler.storage.entities.IJobKey;
@@ -100,7 +99,6 @@ import static org.apache.aurora.scheduler.thrift.Fixtures.CRON_JOB;
 import static org.apache.aurora.scheduler.thrift.Fixtures.CRON_SCHEDULE;
 import static org.apache.aurora.scheduler.thrift.Fixtures.IDENTITY;
 import static org.apache.aurora.scheduler.thrift.Fixtures.JOB_KEY;
-import static org.apache.aurora.scheduler.thrift.Fixtures.LOCK;
 import static org.apache.aurora.scheduler.thrift.Fixtures.QUOTA;
 import static org.apache.aurora.scheduler.thrift.Fixtures.ROLE;
 import static org.apache.aurora.scheduler.thrift.Fixtures.UPDATE_KEY;
@@ -123,7 +121,6 @@ public class ReadOnlySchedulerImplTest extends EasyMockTest {
   private NearestFit nearestFit;
   private CronPredictor cronPredictor;
   private QuotaManager quotaManager;
-  private LockManager lockManager;
 
   private ReadOnlyScheduler.Iface thrift;
 
@@ -134,15 +131,13 @@ public class ReadOnlySchedulerImplTest extends EasyMockTest {
     nearestFit = createMock(NearestFit.class);
     cronPredictor = createMock(CronPredictor.class);
     quotaManager = createMock(QuotaManager.class);
-    lockManager = createMock(LockManager.class);
 
     thrift = new ReadOnlySchedulerImpl(
         TaskTestUtil.CONFIGURATION_MANAGER,
         storageUtil.storage,
         nearestFit,
         cronPredictor,
-        quotaManager,
-        lockManager);
+        quotaManager);
   }
 
   @Test
@@ -317,18 +312,6 @@ public class ReadOnlySchedulerImplTest extends EasyMockTest {
   }
 
   @Test
-  public void testGetLocks() throws Exception {
-    expect(lockManager.getLocks()).andReturn(ImmutableSet.of(LOCK));
-
-    control.replay();
-
-    Response response = thrift.getLocks();
-    assertEquals(
-        LOCK.newBuilder(),
-        Iterables.getOnlyElement(response.getResult().getGetLocksResult().getLocks()));
-  }
-
-  @Test
   public void testGetQuota() throws Exception {
     QuotaInfo infoMock = createMock(QuotaInfo.class);
     expect(quotaManager.getQuotaInfo(ROLE, storageUtil.storeProvider)).andReturn(infoMock);


Mime
View raw message