aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject git commit: Remove deprecated configuration options.
Date Thu, 16 Oct 2014 21:13:47 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master f2d0ca299 -> 3c3b04fd6


Remove deprecated configuration options.

Bugs closed: AURORA-333

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


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

Branch: refs/heads/master
Commit: 3c3b04fd631e6c05e677b298d2c3fd9c5a81ca7d
Parents: f2d0ca2
Author: Zameer Manji <zmanji@twopensource.com>
Authored: Thu Oct 16 14:12:13 2014 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Thu Oct 16 14:12:13 2014 -0700

----------------------------------------------------------------------
 docs/configuration-reference.md                 |  1 -
 .../configuration/ConfigurationManager.java     |  2 -
 .../apache/aurora/client/binding_helper.py      | 12 +--
 src/main/python/apache/aurora/client/config.py  | 83 +-------------------
 src/main/python/apache/aurora/config/recipes.py | 58 --------------
 .../python/apache/aurora/config/schema/base.py  | 40 +---------
 src/main/python/apache/aurora/config/thrift.py  | 46 +++--------
 .../thrift/org/apache/aurora/gen/api.thrift     |  3 -
 .../configuration/ConfigurationManagerTest.java |  7 +-
 .../scheduler/state/LockManagerImplTest.java    |  3 +-
 .../scheduler/state/StateManagerImplTest.java   |  5 +-
 .../thrift/SchedulerThriftInterfaceTest.java    | 15 ++--
 .../aurora/client/api/test_scheduler_client.py  |  5 +-
 .../python/apache/aurora/client/cli/util.py     |  1 -
 .../apache/aurora/client/commands/util.py       |  1 -
 .../python/apache/aurora/client/test_config.py  | 17 ----
 .../python/apache/aurora/config/test_thrift.py  | 16 +---
 17 files changed, 36 insertions(+), 279 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/docs/configuration-reference.md
----------------------------------------------------------------------
diff --git a/docs/configuration-reference.md b/docs/configuration-reference.md
index 5166d45..83d0d10 100644
--- a/docs/configuration-reference.md
+++ b/docs/configuration-reference.md
@@ -318,7 +318,6 @@ Job Schema
   ```update_config``` | ```update_config``` object | Parameters for controlling the rate
and policy of rolling updates.
   ```constraints``` | dict | Scheduling constraints for the tasks. See the section on the
[constraint specification language](#Specifying-Scheduling-Constraints)
   ```service``` | Boolean | If True, restart tasks regardless of success or failure. (Default:
False)
-  ```daemon``` | Boolean | A DEPRECATED alias for "service". (Default: False)
   ```max_task_failures``` | Integer | Maximum number of failures after which the task is
considered to have failed (Default: 1) Set to -1 to allow for infinite failures
   ```priority``` | Integer | Preemption priority to give the task (Default 0). Tasks with
higher priorities may preempt tasks at lower priorities.
   ```production``` | Boolean |  Whether or not this is a production task backed by quota
(Default: False). Production jobs may preempt any non-production job, and may only be preempted
by production jobs in the same role and of higher priority. To run jobs at this level, the
job role must have the appropriate quota.

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/main/java/org/apache/aurora/scheduler/configuration/ConfigurationManager.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/configuration/ConfigurationManager.java
b/src/main/java/org/apache/aurora/scheduler/configuration/ConfigurationManager.java
index 8657421..5871dca 100644
--- a/src/main/java/org/apache/aurora/scheduler/configuration/ConfigurationManager.java
+++ b/src/main/java/org/apache/aurora/scheduler/configuration/ConfigurationManager.java
@@ -44,7 +44,6 @@ import org.apache.aurora.scheduler.storage.entities.ITaskConstraint;
 import org.apache.aurora.scheduler.storage.entities.IValueConstraint;
 import org.apache.commons.lang.StringUtils;
 
-import static org.apache.aurora.gen.apiConstants.DEFAULT_ENVIRONMENT;
 import static org.apache.aurora.gen.apiConstants.GOOD_IDENTIFIER_PATTERN_JVM;
 
 /**
@@ -130,7 +129,6 @@ public final class ConfigurationManager {
           new DefaultField(_Fields.TASK_LINKS, Maps.<String, String>newHashMap()),
           new DefaultField(_Fields.REQUESTED_PORTS, Sets.<String>newHashSet()),
           new DefaultField(_Fields.CONSTRAINTS, Sets.<Constraint>newHashSet()),
-          new DefaultField(_Fields.ENVIRONMENT, DEFAULT_ENVIRONMENT),
           new Closure<TaskConfig>() {
             @Override
             public void execute(TaskConfig task) {

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/main/python/apache/aurora/client/binding_helper.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/binding_helper.py b/src/main/python/apache/aurora/client/binding_helper.py
index 6d6a067..1d9b245 100644
--- a/src/main/python/apache/aurora/client/binding_helper.py
+++ b/src/main/python/apache/aurora/client/binding_helper.py
@@ -35,12 +35,11 @@ class BindingHelper(Interface):
 
   Many bindings are too complex to resolve with bindings using the standard mechanisms,
   because they require some python computation to determine how to bind them. For example,
-  for references like {{packer[role][pkg][version]}}, we need to talk to the packer to figure
-  out the correct packer call for the desired cluster.
+  for references like {{jenkins[build]}}, we need to talk to Jenkins to get the build artifact
URL.
 
   A BindingHelper is responsible for resolving one of these types of pseudo-bindings.
-  PackerBindingHelper will resolve "packer" bindings; BuildBindingHelper will resolve "build"
-  bindings, JenkinsBindingHelper will resolve "jenkins" bindings, etc.
+  BuildBindingHelper will resolve "build" bindings, JenkinsBindingHelper will resolve "jenkins"
+  bindings, etc.
 
   A BindingHelper can be registered by calling "BindingHelper.register(Helper)". Instead
of
   explicitly calling "inject" methods in populate_namespaces, it will compute the set of
open
@@ -54,11 +53,6 @@ class BindingHelper(Interface):
   meet two requirements: it should be enough data to allow it to produce exactly the same
   result as the scratch binding, and the data should provide information that makes the
   binding comprehensible for a human debugging a job.
-
-  For example, a packer helper's binding dict should provide enough information to identify
-  the HDFS file that should be used, but also the version number of the binary in packer,
-  (because a human reader wants to know the version of the package, not the meaningless
-  HDFS URL.
   """
 
   @classmethod

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/main/python/apache/aurora/client/config.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/config.py b/src/main/python/apache/aurora/client/config.py
index e440f58..59703ef 100644
--- a/src/main/python/apache/aurora/client/config.py
+++ b/src/main/python/apache/aurora/client/config.py
@@ -22,52 +22,10 @@ import math
 import re
 import sys
 
-from pystachio import Empty
-
 from apache.aurora.client import binding_helper
-from apache.aurora.client.base import deprecation_warning, die
+from apache.aurora.client.base import die
 from apache.aurora.config import AuroraConfig
 
-from gen.apache.aurora.api.constants import DEFAULT_ENVIRONMENT
-
-
-CRON_DEPRECATION_WARNING = """
-The "cron_policy" parameter to Jobs has been renamed to "cron_collision_policy".
-Please update your Jobs accordingly.
-"""
-
-
-def _warn_on_deprecated_cron_policy(config):
-  if config.raw().cron_policy() is not Empty:
-    deprecation_warning(CRON_DEPRECATION_WARNING)
-
-
-DAEMON_DEPRECATION_WARNING = """
-The "daemon" parameter to Jobs is deprecated in favor of the "service" parameter.
-Please update your Job to set "service = True" instead of "daemon = True", or use
-the top-level Service() instead of Job().
-"""
-
-
-def _warn_on_deprecated_daemon_job(config):
-  if config.raw().daemon() is not Empty:
-    deprecation_warning(DAEMON_DEPRECATION_WARNING)
-
-
-HEALTH_CHECK_INTERVAL_SECS_DEPRECATION_WARNING = """
-The "health_check_interval_secs" parameter to Jobs is deprecated in favor of the
-"health_check_config" parameter. Please update your Job to set the parameter by creating
a new
-HealthCheckConfig.
-
-See the HealthCheckConfig section of the Configuration Reference page for more information:
-http://go/auroraconfig/#Aurora%2BThermosConfigurationReference-HealthCheckConfig
-"""
-
-
-def _warn_on_deprecated_health_check_interval_secs(config):
-  if config.raw().health_check_interval_secs() is not Empty:
-    deprecation_warning(HEALTH_CHECK_INTERVAL_SECS_DEPRECATION_WARNING)
-
 
 ANNOUNCE_WARNING = """
 Announcer specified primary port as '%(primary_port)s' but no processes have bound that port.
@@ -109,8 +67,6 @@ def _validate_environment_name(config):
 UPDATE_CONFIG_MAX_FAILURES_ERROR = '''
 max_total_failures in update_config must be lesser than the job size.
 Based on your job size (%s) you should use max_total_failures <= %s.
-
-See http://go/auroraconfig for details.
 '''
 
 
@@ -118,8 +74,6 @@ UPDATE_CONFIG_DEDICATED_THRESHOLD_ERROR = '''
 Since this is a dedicated job, you must set your max_total_failures in
 your update configuration to no less than 2%% of your job size.
 Based on your job size (%s) you should use max_total_failures >= %s.
-
-See http://go/auroraconfig for details.
 '''
 
 
@@ -156,46 +110,12 @@ def _validate_update_config(config):
         (watch_secs, target_watch, initial_interval_secs, max_consecutive_failures, interval_secs))
 
 
-HEALTH_CHECK_INTERVAL_SECS_ERROR = '''
-health_check_interval_secs paramater to Job has been deprecated. Please specify health_check_config
-only.
-
-See http://go/auroraconfig/#Aurora%2BThermosConfigurationReference-HealthCheckConfig
-'''
-
-
-def _validate_health_check_config(config):
-  # TODO(Sathya): Remove this check after health_check_interval_secs deprecation cycle is
complete.
-  if config.raw().has_health_check_interval_secs() and config.raw().has_health_check_config():
-    die(HEALTH_CHECK_INTERVAL_SECS_ERROR)
-
-
-DEFAULT_ENVIRONMENT_WARNING = '''
-Job did not specify environment, auto-populating to "%s".
-'''
-
-
-def _inject_default_environment(config):
-  if not config.raw().has_environment():
-    print(DEFAULT_ENVIRONMENT_WARNING % DEFAULT_ENVIRONMENT, file=sys.stderr)
-    config.update_job(config.raw()(environment=DEFAULT_ENVIRONMENT))
-
-
 def validate_config(config, env=None):
-  _validate_health_check_config(config)
   _validate_update_config(config)
   _validate_announce_configuration(config)
   _validate_environment_name(config)
 
 
-def populate_namespaces(config, env=None):
-  _inject_default_environment(config)
-  _warn_on_deprecated_cron_policy(config)
-  _warn_on_deprecated_daemon_job(config)
-  _warn_on_deprecated_health_check_interval_secs(config)
-  return config
-
-
 class GlobalHookRegistry(object):
   """To allow enforcable policy, we need a set of mandatory hooks that are
   registered as part of the client executable. Global hooks are registered
@@ -240,7 +160,6 @@ class AnnotatedAuroraConfig(AuroraConfig):
   def plugins(cls):
     return (inject_hooks,
             functools.partial(binding_helper.apply_all),
-            functools.partial(populate_namespaces),
             validate_config)
 
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/main/python/apache/aurora/config/recipes.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/config/recipes.py b/src/main/python/apache/aurora/config/recipes.py
deleted file mode 100644
index 68b5d25..0000000
--- a/src/main/python/apache/aurora/config/recipes.py
+++ /dev/null
@@ -1,58 +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
-
-import pkg_resources
-
-from .loader import AuroraConfigLoader
-
-
-class Recipes(object):
-  """
-    Encapsulate a registry of Recipes (i.e. tasks to mutate the behavior of other tasks.)
-  """
-  REGISTRY = {}
-  RECIPE_EXTENSION = '.aurora_recipe'
-
-  class Error(Exception): pass
-  class UnknownRecipe(Error): pass
-
-  @classmethod
-  def get(cls, name):
-    if name not in cls.REGISTRY:
-      raise cls.UnknownRecipe('Could not find recipe %s!' % name)
-    return cls.REGISTRY[name]
-
-  @classmethod
-  def include_one(cls, filename):
-    recipe_env = AuroraConfigLoader.load(filename)
-    cls.REGISTRY.update(recipe_env.get('recipes', {}))
-
-  @classmethod
-  def include_module(cls, module):
-    for filename in pkg_resources.resource_listdir(module, ''):
-      if filename.endswith(cls.RECIPE_EXTENSION):
-        cls.include_one(os.path.join(module.replace('.', os.sep), filename))
-
-  @classmethod
-  def include(cls, path):
-    if os.path.isfile(path):
-      cls.include_one(path)
-    elif os.path.isdir(path):
-      for filename in os.listdir(path):
-        if filename.endswith(cls.RECIPE_EXTENSION):
-          cls.include_one(os.path.join(path, filename))
-    else:
-      raise ValueError('Could not find %s' % path)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/main/python/apache/aurora/config/schema/base.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/config/schema/base.py b/src/main/python/apache/aurora/config/schema/base.py
index f12634f..d789779 100644
--- a/src/main/python/apache/aurora/config/schema/base.py
+++ b/src/main/python/apache/aurora/config/schema/base.py
@@ -17,8 +17,6 @@
 
 from apache.thermos.config.schema import *
 
-from gen.apache.aurora.api.constants import DEFAULT_ENVIRONMENT
-
 
 # TODO(wickman) Bind {{mesos.instance}} to %shard_id%
 class MesosContext(Struct):
@@ -26,30 +24,6 @@ class MesosContext(Struct):
   instance    = Required(Integer)
 
 
-# The object bound into the {{packer}} namespace.
-# Referenced by
-#  {{packer[role][name][version]}}
-#
-# Where version =
-#    number (integer)
-#    'live' (live package)
-#    'latest' (highest version number)
-#
-# For example if you'd like to create a copy process for a particular
-# package,
-#   copy_latest = Process(
-#     name = 'copy-{{package_name}}',
-#     cmdline = '{{packer[{{role}}][{{package_name}}][latest].copy_command}}')
-#   processes = [
-#     copy_latest.bind(package_name = 'labrat'),
-#     copy_latest.bind(package_name = 'packer')
-#   ]
-class PackerObject(Struct):
-  package = String
-  package_uri = String
-  copy_command = String
-
-
 class UpdateConfig(Struct):
   batch_size                  = Default(Integer, 1)
   restart_threshold           = Default(Integer, 60)
@@ -87,8 +61,7 @@ class MesosTaskInstance(Struct):
   instance                   = Required(Integer)
   role                       = Required(String)
   announce                   = Announcer
-  environment                = Default(String, DEFAULT_ENVIRONMENT)
-  health_check_interval_secs = Default(Integer, 10) # DEPRECATED (MESOS-2649)
+  environment                = Required(String)
   health_check_config        = Default(HealthCheckConfig, HealthCheckConfig())
 
 
@@ -100,25 +73,18 @@ class MesosJob(Struct):
   environment   = Required(String)
   instances     = Default(Integer, 1)
   task          = Required(Task)
-  recipes       = List(String)
   announce      = Announcer
 
   cron_schedule = String
-  cron_policy   = String          # these two are aliases of each other.  default is KILL_EXISTING
-  cron_collision_policy = String  # if unspecified.
-                                  # cron_policy is DEPRECATED (MESOS-2491) in favor of
-                                  # cron_collision_policy.
+  cron_collision_policy = Default(String, "KILL_EXISTING")
 
   update_config = Default(UpdateConfig, UpdateConfig())
 
   constraints                = Map(String, String)
-  daemon                     = Boolean  # daemon and service are aliased together.
-  service                    = Boolean  # daemon is DEPRECATED (MESOS-2492) in favor of
-                                        # service.  by default, service is False.
+  service                    = Default(Boolean, False)
   max_task_failures          = Default(Integer, 1)
   production                 = Default(Boolean, False)
   priority                   = Default(Integer, 0)
-  health_check_interval_secs = Integer # DEPRECATED in favor of health_check_config (MESOS-2649).
   health_check_config        = Default(HealthCheckConfig, HealthCheckConfig())
   task_links                 = Map(String, String)
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/main/python/apache/aurora/config/thrift.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/config/thrift.py b/src/main/python/apache/aurora/config/thrift.py
index 288fb40..9ca806d 100644
--- a/src/main/python/apache/aurora/config/thrift.py
+++ b/src/main/python/apache/aurora/config/thrift.py
@@ -76,15 +76,12 @@ def constraints_to_thrift(constraints):
 
 def task_instance_from_job(job, instance):
   instance_context = MesosContext(instance=instance)
-  # TODO(Sathya): Remove health_check_interval_secs references after deprecation cycle is
complete.
   health_check_config = HealthCheckConfig()
-  if job.has_health_check_interval_secs():
-    health_check_config = HealthCheckConfig(interval_secs=job.health_check_interval_secs().get())
-  elif job.has_health_check_config():
+  if job.has_health_check_config():
     health_check_config = job.health_check_config()
+
   ti = MesosTaskInstance(task=job.task(),
                          role=job.role(),
-                         health_check_interval_secs=health_check_config.interval_secs().get(),
                          health_check_config=health_check_config,
                          instance=instance)
   if job.has_announce():
@@ -94,13 +91,6 @@ def task_instance_from_job(job, instance):
   return ti.bind(mesos=instance_context).interpolate()
 
 
-def translate_cron_policy(policy):
-  cron_policy = CronCollisionPolicy._NAMES_TO_VALUES.get(policy.get())
-  if cron_policy is None:
-    raise InvalidConfig('Invalid cron policy: %s' % policy.get())
-  return cron_policy
-
-
 def fully_interpolated(pystachio_object, coerce_fn=lambda i: i):
   # Extract a fully-interpolated unwrapped object from pystachio_object or raise InvalidConfig.
   #
@@ -116,29 +106,18 @@ def fully_interpolated(pystachio_object, coerce_fn=lambda i: i):
   return coerce_fn(value.get())
 
 
-def select_cron_policy(cron_policy, cron_collision_policy):
-  if cron_policy is Empty and cron_collision_policy is Empty:
-    return CronCollisionPolicy.KILL_EXISTING
-  elif cron_policy is not Empty and cron_collision_policy is Empty:
-    return translate_cron_policy(cron_policy)
-  elif cron_policy is Empty and cron_collision_policy is not Empty:
-    return translate_cron_policy(cron_collision_policy)
-  else:
-    raise InvalidConfig('Specified both cron_policy and cron_collision_policy!')
+def select_cron_policy(cron_policy):
+  policy = CronCollisionPolicy._NAMES_TO_VALUES.get(cron_policy.get())
+  if policy is None:
+    raise InvalidConfig('Invalid cron policy: %s' % cron_policy.get())
+  return policy
 
 
 def select_service_bit(job):
-  if not job.has_daemon() and not job.has_service():
-    return False
-  elif job.has_daemon() and not job.has_service():
-    return fully_interpolated(job.daemon(), bool)
-  elif not job.has_daemon() and job.has_service():
-    return fully_interpolated(job.service(), bool)
-  else:
-    raise InvalidConfig('Specified both daemon and service bits!')
+  return fully_interpolated(job.service(), bool)
 
 
-# TODO(wickman) Due to MESOS-2718 we should revert to using the MesosTaskInstance.
+# TODO(wickman): We should revert to using the MesosTaskInstance.
 #
 # Using the MesosJob instead of the MesosTaskInstance was to allow for
 # planned future use of fields such as 'cluster' and to allow for conversion
@@ -147,13 +126,8 @@ def select_service_bit(job):
 #
 # In the meantime, we are erasing fields of the Job that are controversial.
 # This achieves roughly the same effect as using the MesosTaskInstance.
-# The future work is tracked at MESOS-2727.
 ALIASED_FIELDS = (
-  'cron_policy',
-  'cron_collision_policy',
   'update_config',
-  'daemon',
-  'service',
   'instances'
 )
 
@@ -256,6 +230,6 @@ def convert(job, metadata=frozenset(), ports=frozenset()):
       key=key,
       owner=owner,
       cronSchedule=not_empty_or(job.cron_schedule(), None),
-      cronCollisionPolicy=select_cron_policy(job.cron_policy(), job.cron_collision_policy()),
+      cronCollisionPolicy=select_cron_policy(job.cron_collision_policy()),
       taskConfig=task,
       instanceCount=fully_interpolated(job.instances()))

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/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 8794731..77092bd 100644
--- a/src/main/thrift/org/apache/aurora/gen/api.thrift
+++ b/src/main/thrift/org/apache/aurora/gen/api.thrift
@@ -394,9 +394,6 @@ const set<ScheduleStatus> TERMINAL_STATES = [ScheduleStatus.FAILED,
                                              ScheduleStatus.LOST,
                                              ScheduleStatus.SANDBOX_DELETED]
 
-// Environment assigned to a job when unspecified
-const string DEFAULT_ENVIRONMENT = "devel"
-
 // 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\\-\\.]+$"

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/test/java/org/apache/aurora/scheduler/configuration/ConfigurationManagerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/configuration/ConfigurationManagerTest.java
b/src/test/java/org/apache/aurora/scheduler/configuration/ConfigurationManagerTest.java
index ee95875..dc2cb37 100644
--- a/src/test/java/org/apache/aurora/scheduler/configuration/ConfigurationManagerTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/configuration/ConfigurationManagerTest.java
@@ -28,19 +28,17 @@ import org.apache.aurora.gen.TaskConstraint;
 import org.apache.aurora.gen.ValueConstraint;
 import org.junit.Test;
 
-import static org.apache.aurora.gen.apiConstants.DEFAULT_ENVIRONMENT;
 import static org.apache.aurora.gen.test.testConstants.INVALID_IDENTIFIERS;
 import static org.apache.aurora.gen.test.testConstants.VALID_IDENTIFIERS;
 import static org.apache.aurora.scheduler.configuration.ConfigurationManager.DEDICATED_ATTRIBUTE;
 import static org.apache.aurora.scheduler.configuration.ConfigurationManager.isGoodIdentifier;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 // TODO(kevints): Improve test coverage for this class.
 public class ConfigurationManagerTest {
   private static final JobConfiguration UNSANITIZED_JOB_CONFIGURATION = new JobConfiguration()
-      .setKey(new JobKey("owner-role", DEFAULT_ENVIRONMENT, "email_stats"))
+      .setKey(new JobKey("owner-role", "devel", "email_stats"))
       .setCronSchedule("0 2 * * *")
       .setCronCollisionPolicy(CronCollisionPolicy.KILL_EXISTING)
       .setInstanceCount(1)
@@ -49,7 +47,7 @@ public class ConfigurationManagerTest {
               .setIsService(false)
               .setTaskLinks(ImmutableMap.<String, String>of())
               .setExecutorConfig(new ExecutorConfig("aurora", "config"))
-              .setEnvironment(DEFAULT_ENVIRONMENT)
+              .setEnvironment("devel")
               .setRequestedPorts(ImmutableSet.<String>of())
               .setJobName(null)
               .setPriority(0)
@@ -97,6 +95,5 @@ public class ConfigurationManagerTest {
 
     ConfigurationManager.applyDefaultsIfUnset(copy);
     assertTrue(copy.isSetKey());
-    assertEquals(DEFAULT_ENVIRONMENT, copy.getKey().getEnvironment());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/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 a3054d8..6e499d1 100644
--- a/src/test/java/org/apache/aurora/scheduler/state/LockManagerImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/state/LockManagerImplTest.java
@@ -43,7 +43,6 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
-import static org.apache.aurora.gen.apiConstants.DEFAULT_ENVIRONMENT;
 import static org.apache.aurora.scheduler.storage.Storage.Work;
 import static org.easymock.EasyMock.expect;
 import static org.junit.Assert.assertEquals;
@@ -52,7 +51,7 @@ public class LockManagerImplTest extends EasyMockTest {
   private static final String USER = "jim-user";
   private static final Identity JIM = new Identity("jim", USER);
   private static final String MY_JOB = "myJob";
-  private static final IJobKey JOB_KEY = JobKeys.from(JIM.getRole(), DEFAULT_ENVIRONMENT,
MY_JOB);
+  private static final IJobKey JOB_KEY = JobKeys.from(JIM.getRole(), "devel", MY_JOB);
   private static final ILockKey LOCK_KEY = ILockKey.build(LockKey.job(JOB_KEY.newBuilder()));
   private static final UUID TOKEN = UUID.fromString("79d6d790-3212-11e3-aa6e-0800200c9a66");
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/test/java/org/apache/aurora/scheduler/state/StateManagerImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/state/StateManagerImplTest.java b/src/test/java/org/apache/aurora/scheduler/state/StateManagerImplTest.java
index cdd29ea..7b67c24 100644
--- a/src/test/java/org/apache/aurora/scheduler/state/StateManagerImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/state/StateManagerImplTest.java
@@ -66,7 +66,6 @@ import static org.apache.aurora.gen.ScheduleStatus.PENDING;
 import static org.apache.aurora.gen.ScheduleStatus.RUNNING;
 import static org.apache.aurora.gen.ScheduleStatus.SANDBOX_DELETED;
 import static org.apache.aurora.gen.ScheduleStatus.THROTTLED;
-import static org.apache.aurora.gen.apiConstants.DEFAULT_ENVIRONMENT;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.expectLastCall;
 import static org.junit.Assert.assertEquals;
@@ -78,7 +77,7 @@ public class StateManagerImplTest extends EasyMockTest {
   private static final String HOST_A = "host_a";
   private static final Identity JIM = new Identity("jim", "jim-user");
   private static final String MY_JOB = "myJob";
-  private static final IJobKey JOB_KEY = JobKeys.from(JIM.getRole(), DEFAULT_ENVIRONMENT,
MY_JOB);
+  private static final IJobKey JOB_KEY = JobKeys.from(JIM.getRole(), "devel", MY_JOB);
 
   private Driver driver;
   private TaskIdGenerator taskIdGenerator;
@@ -527,7 +526,7 @@ public class StateManagerImplTest extends EasyMockTest {
   private static ITaskConfig makeTask(Identity owner, String job) {
     return ITaskConfig.build(new TaskConfig()
         .setOwner(owner)
-        .setEnvironment(DEFAULT_ENVIRONMENT)
+        .setEnvironment("devel")
         .setJobName(job)
         .setRequestedPorts(ImmutableSet.<String>of()));
   }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/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 ebe879c..f36a88f 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
@@ -157,7 +157,6 @@ import static org.apache.aurora.gen.ResponseCode.INVALID_REQUEST;
 import static org.apache.aurora.gen.ResponseCode.LOCK_ERROR;
 import static org.apache.aurora.gen.ResponseCode.OK;
 import static org.apache.aurora.gen.ResponseCode.WARNING;
-import static org.apache.aurora.gen.apiConstants.DEFAULT_ENVIRONMENT;
 import static org.apache.aurora.gen.apiConstants.THRIFT_API_VERSION;
 import static org.apache.aurora.scheduler.configuration.ConfigurationManager.DEDICATED_ATTRIBUTE;
 import static org.apache.aurora.scheduler.quota.QuotaCheckResult.Result.INSUFFICIENT_QUOTA;
@@ -183,7 +182,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
   private static final String JOB_NAME = "job_foo";
   private static final Identity ROLE_IDENTITY = new Identity(ROLE, USER);
   private static final SessionKey SESSION = new SessionKey();
-  private static final IJobKey JOB_KEY = JobKeys.from(ROLE, DEFAULT_ENVIRONMENT, JOB_NAME);
+  private static final IJobKey JOB_KEY = JobKeys.from(ROLE, "devel", JOB_NAME);
   private static final ILockKey LOCK_KEY = ILockKey.build(LockKey.job(JOB_KEY.newBuilder()));
   private static final ILock LOCK =
       ILock.build(new Lock().setKey(LOCK_KEY.newBuilder()).setToken("token"));
@@ -631,7 +630,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
         .setIsService(true)
         .setProduction(true)
         .setOwner(ROLE_IDENTITY)
-        .setEnvironment(DEFAULT_ENVIRONMENT)
+        .setEnvironment("devel")
         .setJobName(JOB_NAME);
     JobConfiguration job = makeJob(task);
 
@@ -651,7 +650,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
             ConfigurationManager.hostLimitConstraint(1),
             ConfigurationManager.rackLimitConstraint(1)))
         .setMaxTaskFailures(1)
-        .setEnvironment(DEFAULT_ENVIRONMENT);
+        .setEnvironment("devel");
 
     lockManager.validateIfLocked(LOCK_KEY, Optional.<ILock>absent());
     storageUtil.expectTaskFetch(Query.jobScoped(JOB_KEY).active());
@@ -719,7 +718,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
             .setTaskId(taskId)
             .setTask(new TaskConfig()
                 .setOwner(ROLE_IDENTITY)
-                .setEnvironment(DEFAULT_ENVIRONMENT)
+                .setEnvironment("devel")
                 .setJobName(jobName))));
   }
 
@@ -789,7 +788,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
     Query.Builder query = Query.unscoped().byJob(JOB_KEY).active();
     IScheduledTask task2 = buildScheduledTask("job_bar", TASK_ID);
     ILockKey key2 = ILockKey.build(LockKey.job(
-        JobKeys.from(ROLE, DEFAULT_ENVIRONMENT, "job_bar").newBuilder()));
+        JobKeys.from(ROLE, "devel", "job_bar").newBuilder()));
     expectAuth(ROOT, false);
     expectAuth(ROLE, true);
     storageUtil.expectTaskFetch(query, buildScheduledTask(), task2);
@@ -2237,7 +2236,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
     assertResponse(ERROR, thrift.startJobUpdate(new JobUpdateRequest(
         new TaskConfig()
             .setJobName("&")
-            .setEnvironment(DEFAULT_ENVIRONMENT)
+            .setEnvironment("devel")
             .setOwner(new Identity(ROLE, null)),
         5,
         buildJobUpdateSettings()), SESSION));
@@ -2633,7 +2632,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
   private static TaskConfig defaultTask(boolean production) {
     return new TaskConfig()
         .setOwner(new Identity(ROLE, USER))
-        .setEnvironment(DEFAULT_ENVIRONMENT)
+        .setEnvironment("devel")
         .setJobName(JOB_NAME)
         .setContactEmail("testing@twitter.com")
         .setExecutorConfig(new ExecutorConfig("aurora", "data"))

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/test/python/apache/aurora/client/api/test_scheduler_client.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_scheduler_client.py b/src/test/python/apache/aurora/client/api/test_scheduler_client.py
index e97bb2a..076008e 100644
--- a/src/test/python/apache/aurora/client/api/test_scheduler_client.py
+++ b/src/test/python/apache/aurora/client/api/test_scheduler_client.py
@@ -30,7 +30,7 @@ from apache.aurora.common.transport import TRequestsTransport
 
 import gen.apache.aurora.api.AuroraAdmin as AuroraAdmin
 import gen.apache.aurora.api.AuroraSchedulerManager as AuroraSchedulerManager
-from gen.apache.aurora.api.constants import DEFAULT_ENVIRONMENT, THRIFT_API_VERSION
+from gen.apache.aurora.api.constants import THRIFT_API_VERSION
 from gen.apache.aurora.api.ttypes import (
     Hosts,
     JobConfiguration,
@@ -51,7 +51,8 @@ from gen.apache.aurora.api.ttypes import (
 
 ROLE = 'foorole'
 JOB_NAME = 'barjobname'
-JOB_KEY = JobKey(role=ROLE, environment=DEFAULT_ENVIRONMENT, name=JOB_NAME)
+JOB_ENV = 'devel'
+JOB_KEY = JobKey(role=ROLE, environment=JOB_ENV, name=JOB_NAME)
 DEFAULT_RESPONSE = Response(serverInfo=ServerInfo(thriftAPIVersion=THRIFT_API_VERSION))
 
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/test/python/apache/aurora/client/cli/util.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/util.py b/src/test/python/apache/aurora/client/cli/util.py
index 967b5dc..3fa609a 100644
--- a/src/test/python/apache/aurora/client/cli/util.py
+++ b/src/test/python/apache/aurora/client/cli/util.py
@@ -244,7 +244,6 @@ jobs = [HELLO_WORLD]
 
   TEST_CLUSTERS = Clusters([Cluster(
       name='west',
-      packer_copy_command='copying {{package}}',
       zk='zookeeper.example.com',
       scheduler_zk_path='/foo/bar',
       auth_mechanism='UNAUTHENTICATED')])

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/test/python/apache/aurora/client/commands/util.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/commands/util.py b/src/test/python/apache/aurora/client/commands/util.py
index 663f2f4..65a358a 100644
--- a/src/test/python/apache/aurora/client/commands/util.py
+++ b/src/test/python/apache/aurora/client/commands/util.py
@@ -110,7 +110,6 @@ jobs = [HELLO_WORLD]
 
   TEST_CLUSTERS = Clusters([Cluster(
       name='west',
-      packer_copy_command='copying {{package}}',
       zk='zookeeper.example.com',
       scheduler_zk_path='/foo/bar',
       auth_mechanism='UNAUTHENTICATED')])

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/test/python/apache/aurora/client/test_config.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/test_config.py b/src/test/python/apache/aurora/client/test_config.py
index 901c337..c567797 100644
--- a/src/test/python/apache/aurora/client/test_config.py
+++ b/src/test/python/apache/aurora/client/test_config.py
@@ -30,8 +30,6 @@ from apache.aurora.config.schema.base import (
     UpdateConfig
 )
 
-from gen.apache.aurora.api.constants import DEFAULT_ENVIRONMENT
-
 MESOS_CONFIG_BASE = """
 HELLO_WORLD = Job(
   name = 'hello_world',
@@ -133,21 +131,6 @@ def test_environment_names():
       config._validate_environment_name(AuroraConfig(base_job(environment=env_name)))
 
 
-def test_inject_default_environment():
-  base_job = Job(
-      name='hello_world', role='john_doe', cluster='test-cluster',
-      task=Task(name='main', processes=[],
-                resources=Resources(cpu=0.1, ram=64 * MB, disk=64 * MB)))
-
-  no_env_config = AuroraConfig(base_job)
-  config._inject_default_environment(no_env_config)
-  assert no_env_config.environment() == DEFAULT_ENVIRONMENT
-
-  test_env_config = AuroraConfig(base_job(environment='test'))
-  config._inject_default_environment(test_env_config)
-  assert test_env_config.environment() == 'test'
-
-
 def test_dedicated_portmap():
   base_job = Job(
       name='hello_world', role='john_doe', cluster='test-cluster',

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/3c3b04fd/src/test/python/apache/aurora/config/test_thrift.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/config/test_thrift.py b/src/test/python/apache/aurora/config/test_thrift.py
index fd28313..1dd9e79 100644
--- a/src/test/python/apache/aurora/config/test_thrift.py
+++ b/src/test/python/apache/aurora/config/test_thrift.py
@@ -20,7 +20,7 @@ from pystachio import Map, String
 from pystachio.naming import frozendict
 
 from apache.aurora.config import AuroraConfig
-from apache.aurora.config.schema.base import Job, SimpleTask
+from apache.aurora.config.schema.base import HealthCheckConfig, Job, SimpleTask
 from apache.aurora.config.thrift import convert as convert_pystachio_to_thrift
 from apache.aurora.config.thrift import InvalidConfig, task_instance_from_job
 from apache.thermos.config.schema import Process, Resources, Task
@@ -71,7 +71,7 @@ def test_config_with_options():
     production=True,
     priority=200,
     service=True,
-    cron_policy='RUN_OVERLAP',
+    cron_collision_policy='RUN_OVERLAP',
     constraints={
       'dedicated': 'root',
       'cpu': 'x86_64'
@@ -166,7 +166,7 @@ def test_unbound_references():
     convert_pystachio_to_thrift(job_command('echo {{mesos.user}}'))
 
 
-def test_cron_policy_alias():
+def test_cron_collision_policy():
   cron_schedule = '*/10 * * * *'
   CRON_HELLO_WORLD = HELLO_WORLD(cron_schedule=cron_schedule)
 
@@ -174,19 +174,11 @@ def test_cron_policy_alias():
   assert tti.cronSchedule == cron_schedule
   assert tti.cronCollisionPolicy == CronCollisionPolicy.KILL_EXISTING
 
-  tti = convert_pystachio_to_thrift(CRON_HELLO_WORLD(cron_policy='RUN_OVERLAP'))
-  assert tti.cronSchedule == cron_schedule
-  assert tti.cronCollisionPolicy == CronCollisionPolicy.RUN_OVERLAP
-
   tti = convert_pystachio_to_thrift(CRON_HELLO_WORLD(cron_collision_policy='RUN_OVERLAP'))
   assert tti.cronSchedule == cron_schedule
   assert tti.cronCollisionPolicy == CronCollisionPolicy.RUN_OVERLAP
 
   with pytest.raises(ValueError):
-    tti = convert_pystachio_to_thrift(CRON_HELLO_WORLD(cron_policy='RUN_OVERLAP',
-                                                       cron_collision_policy='RUN_OVERLAP'))
-
-  with pytest.raises(ValueError):
     tti = convert_pystachio_to_thrift(CRON_HELLO_WORLD(cron_collision_policy='GARBAGE'))
 
 
@@ -202,7 +194,7 @@ def test_metadata_in_config():
 
 
 def test_task_instance_from_job():
-  instance = task_instance_from_job(Job(health_check_interval_secs=30), 0)
+  instance = task_instance_from_job(Job(health_check_config=HealthCheckConfig(interval_secs=30)),
0)
   assert instance is not None
 
 


Mime
View raw message