Repository: aurora Updated Branches: refs/heads/master 76db37d97 -> 56906a796
Re-enable python style check in the integration build. pants test does not appear to invoke the python checkstyle. Re-enable it by explicitly calling in the integration build script. Also fix the few issues that have already been commited. Reviewed at https://reviews.apache.org/r/51484/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/56906a79 Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/56906a79 Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/56906a79 Branch: refs/heads/master Commit: 56906a79644807a8e7a909656cf513c2eece3a3b Parents: 76db37d Author: Santhosh Kumar Shanmugham <[email protected]> Authored: Mon Aug 29 11:02:12 2016 -0600 Committer: John Sirois <[email protected]> Committed: Mon Aug 29 11:02:12 2016 -0600 ---------------------------------------------------------------------- build-support/jenkins/build.sh | 1 + .../python/apache/aurora/client/cli/context.py | 2 +- .../python/apache/aurora/client/cli/update.py | 14 +++++++----- src/main/python/apache/thermos/core/process.py | 1 - .../aurora/executor/common/test_sandbox.py | 24 ++++++++++---------- .../python/apache/thermos/core/test_process.py | 4 ++-- 6 files changed, 24 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/56906a79/build-support/jenkins/build.sh ---------------------------------------------------------------------- diff --git a/build-support/jenkins/build.sh b/build-support/jenkins/build.sh index 1de1446..e54bd2a 100755 --- a/build-support/jenkins/build.sh +++ b/build-support/jenkins/build.sh @@ -24,6 +24,7 @@ date ./build-support/python/isort-check # Run remaining Python style checks and all tests +./build-support/python/checkstyle-check ./pants test.pytest --junit-xml-dir="$PWD/dist/test-results" \ src/{main,test}/python:: -- -v http://git-wip-us.apache.org/repos/asf/aurora/blob/56906a79/src/main/python/apache/aurora/client/cli/context.py ---------------------------------------------------------------------- diff --git a/src/main/python/apache/aurora/client/cli/context.py b/src/main/python/apache/aurora/client/cli/context.py index f1a256a..9cf5839 100644 --- a/src/main/python/apache/aurora/client/cli/context.py +++ b/src/main/python/apache/aurora/client/cli/context.py @@ -30,7 +30,7 @@ from apache.aurora.client.cli import ( EXIT_INVALID_PARAMETER, Context ) -from apache.aurora.client.config import AnnotatedAuroraConfig, get_config +from apache.aurora.client.config import get_config from apache.aurora.client.hooks.hooked_api import HookedAuroraClientAPI from apache.aurora.common.aurora_job_key import AuroraJobKey from apache.aurora.common.clusters import CLUSTERS http://git-wip-us.apache.org/repos/asf/aurora/blob/56906a79/src/main/python/apache/aurora/client/cli/update.py ---------------------------------------------------------------------- diff --git a/src/main/python/apache/aurora/client/cli/update.py b/src/main/python/apache/aurora/client/cli/update.py index 23aaa2c..d23243d 100644 --- a/src/main/python/apache/aurora/client/cli/update.py +++ b/src/main/python/apache/aurora/client/cli/update.py @@ -110,6 +110,7 @@ class UpdateController(object): "Failed to abort update due to error:", "Update has been aborted.") + def format_timestamp(stamp_millis): return datetime.datetime.utcfromtimestamp(stamp_millis / 1000).isoformat() @@ -128,6 +129,7 @@ WAIT_OPTION = lambda help_msg: CommandOption( action='store_true', help=help_msg) + class StartUpdate(Verb): UPDATE_MSG_TEMPLATE = "Job update has started. View your update progress at %s" @@ -203,15 +205,15 @@ class StartUpdate(Verb): def rollback_state_to_err_code(state): - return (EXIT_OK if state == JobUpdateStatus.ROLLED_BACK else - EXIT_COMMAND_FAILURE if state == JobUpdateStatus.ROLLED_FORWARD else - EXIT_UNKNOWN_ERROR) + return (EXIT_OK if state == JobUpdateStatus.ROLLED_BACK else + EXIT_COMMAND_FAILURE if state == JobUpdateStatus.ROLLED_FORWARD else + EXIT_UNKNOWN_ERROR) def update_state_to_err_code(state): - return (EXIT_OK if state == JobUpdateStatus.ROLLED_FORWARD else - EXIT_COMMAND_FAILURE if state == JobUpdateStatus.ROLLED_BACK else - EXIT_UNKNOWN_ERROR) + return (EXIT_OK if state == JobUpdateStatus.ROLLED_FORWARD else + EXIT_COMMAND_FAILURE if state == JobUpdateStatus.ROLLED_BACK else + EXIT_UNKNOWN_ERROR) def wait_for_update(context, clock, api, update_key, state_to_err_code_func): http://git-wip-us.apache.org/repos/asf/aurora/blob/56906a79/src/main/python/apache/thermos/core/process.py ---------------------------------------------------------------------- diff --git a/src/main/python/apache/thermos/core/process.py b/src/main/python/apache/thermos/core/process.py index 78e7d78..2134d4f 100644 --- a/src/main/python/apache/thermos/core/process.py +++ b/src/main/python/apache/thermos/core/process.py @@ -459,7 +459,6 @@ class Process(ProcessBase): wrapped_cmdline = self.wrapped_cmdline(cwd) log.debug('Wrapped cmdline: %s' % wrapped_cmdline) - real_thermos_profile_path = os.path.join( os.environ['MESOS_DIRECTORY'], TASK_FILESYSTEM_MOUNT_POINT, http://git-wip-us.apache.org/repos/asf/aurora/blob/56906a79/src/test/python/apache/aurora/executor/common/test_sandbox.py ---------------------------------------------------------------------- diff --git a/src/test/python/apache/aurora/executor/common/test_sandbox.py b/src/test/python/apache/aurora/executor/common/test_sandbox.py index b30a5bc..2ba3341 100644 --- a/src/test/python/apache/aurora/executor/common/test_sandbox.py +++ b/src/test/python/apache/aurora/executor/common/test_sandbox.py @@ -143,20 +143,19 @@ def test_destroy_ioerror(): def assert_create_user_and_group(mock_check_call, gid_exists, uid_exists): mock_pwent = pwd.struct_passwd(( - 'someuser', # login name - 'hunter2', # password - 834, # uid - 835, # gid - 'Some User', # user name - '/home/someuser', # home directory - '/bin/sh')) # login shell + 'someuser', # login name + 'hunter2', # password + 834, # uid + 835, # gid + 'Some User', # user name + '/home/someuser', # home directory + '/bin/sh')) # login shell mock_grent = grp.struct_group(( - 'users', # group name - '*', # password - 835, # gid - ['someuser'])) # members - + 'users', # group name + '*', # password + 835, # gid + ['someuser'])) # members exception = subprocess.CalledProcessError( returncode=FileSystemImageSandbox._USER_OR_GROUP_ID_EXISTS, @@ -236,6 +235,7 @@ def test_filesystem_sandbox_mounts_paths(mock_safe_mkdir, mock_check_call): ]) ] + @mock.patch('subprocess.check_call') @mock.patch('apache.aurora.executor.common.sandbox.safe_mkdir') @mock.patch.dict(os.environ, {'MESOS_DIRECTORY': MOCK_MESOS_DIRECTORY}) http://git-wip-us.apache.org/repos/asf/aurora/blob/56906a79/src/test/python/apache/thermos/core/test_process.py ---------------------------------------------------------------------- diff --git a/src/test/python/apache/thermos/core/test_process.py b/src/test/python/apache/thermos/core/test_process.py index 49f52d9..2fd3d96 100644 --- a/src/test/python/apache/thermos/core/test_process.py +++ b/src/test/python/apache/thermos/core/test_process.py @@ -134,8 +134,8 @@ def test_simple_process_filesystem_isolator(): assert_log_content( taskpath, 'stdout', - 'launch --unshare_namespace_mnt --working_directory=%s --rootfs=/some/path/taskfs --user=None ' - '--command={"shell":true,"value":"/bin/bash -c \'echo hello world\'"}\n' % ( + 'launch --unshare_namespace_mnt --working_directory=%s --rootfs=/some/path/taskfs ' + '--user=None --command={"shell":true,"value":"/bin/bash -c \'echo hello world\'"}\n' % ( sandbox))
