> On March 19, 2014, 7:07 p.m., Brian Wickman wrote: > > src/main/python/apache/aurora/client/hooks/hooked_api.py, lines 130-131 > > <https://reviews.apache.org/r/19411/diff/1/?file=528094#file528094line130> > > > > you'll want GlobalHookRegistry.get_hooks() to return cls.HOOKS[:], > > otherwise 'hooks += config.hooks' will actually mutate the global registry
Or you can favor immutability and have GlobalHooksRegistry.get_hooks() return a tuple. Then a += b really is just shorthand for a = a + b. - Kevin ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/19411/#review37855 ----------------------------------------------------------- On March 20, 2014, 6:28 a.m., Mark Chu-Carroll wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/19411/ > ----------------------------------------------------------- > > (Updated March 20, 2014, 6:28 a.m.) > > > Review request for Aurora, Maxim Khutornenko and Brian Wickman. > > > Bugs: aurora-269 > https://issues.apache.org/jira/browse/aurora-269 > > > Repository: aurora > > > Description > ------- > > Add support for global hooks. > > To support site-specific policy requirements, we'd like to be able to have > hooks that are applied to every configuration, and that are used regardless > of whether a configuration specifically enables hooks. We'd like these to be > baked in to the client. > > This change adds a global registry, which can be initialized with a set of > global hooks. In case of errors/emergencies, there is an override flag to > disable the global hooks. > > > Diffs > ----- > > src/main/python/apache/aurora/client/commands/core.py > 9977c725528086d3e8cf58de294adee542570411 > src/main/python/apache/aurora/client/config.py > 1fe5db429007850911f19517565d49b0518e8196 > src/main/python/apache/aurora/client/hooks/hooked_api.py > 6de81347e021a71fc6aef598e6933c440335c8bf > src/main/python/apache/aurora/client/options.py > b8278bdeeb777a1b6a72167100323fb177bc9636 > src/test/python/apache/aurora/client/commands/BUILD > 7c808089f1456f5907aaf95d3f8d025f576a56f6 > src/test/python/apache/aurora/client/commands/test_admin_sla.py > 51e74823e90f460200d60065ea0ad31bd57a34f6 > src/test/python/apache/aurora/client/commands/test_cancel_update.py > 7824b764561cc95614c196c297137b0a6b49dccc > src/test/python/apache/aurora/client/commands/test_create.py > adbff90f23b958eae03da41ef7cbc5bedc84f1c8 > src/test/python/apache/aurora/client/commands/test_diff.py > fc154214574c19e0fff1e4be82cd61dd42f676b6 > src/test/python/apache/aurora/client/commands/test_hooks.py PRE-CREATION > src/test/python/apache/aurora/client/commands/test_kill.py > 75e754ba2a850287ec0c3bbdee7289231ad35b2a > src/test/python/apache/aurora/client/commands/test_listjobs.py > 099475c90d3a5f350fe3240c345911a59f35df92 > src/test/python/apache/aurora/client/commands/test_maintenance.py > df368e2f89149ff6b18b174e61657f3faa9cb0ab > src/test/python/apache/aurora/client/commands/test_restart.py > 1cab2a2dd4b1bc58a6ea47c7a07a3cc92f4b20cd > src/test/python/apache/aurora/client/commands/test_run.py > fe666158e0e9ad38b4b4f0c2b91af737eef130cd > src/test/python/apache/aurora/client/commands/test_ssh.py > 2fe12ef5660f7ae2bf36493e6f1f6bc63ee9ccc7 > src/test/python/apache/aurora/client/commands/test_status.py > eed798d2475280c787bea749647528cfd0715a40 > src/test/python/apache/aurora/client/commands/test_update.py > 21951b6b06321894607531884a0acd75e303204e > src/test/python/apache/aurora/client/hooks/BUILD > 3d6f7966356fbe2b02868650a9784d3155884092 > > Diff: https://reviews.apache.org/r/19411/diff/ > > > Testing > ------- > > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 2 items > > src/test/python/apache/aurora/client/test_binding_helper.py .. > > =========================== 2 passed in 0.37 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 6 items > > src/test/python/apache/aurora/client/test_config.py ...... > > =========================== 6 passed in 0.48 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 6 items > > src/test/python/apache/aurora/client/api/test_disambiguator.py ...... > > =========================== 6 passed in 0.43 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 1 items > > src/test/python/apache/aurora/client/api/test_job_monitor.py . > > =========================== 1 passed in 0.40 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 6 items > > src/test/python/apache/aurora/client/api/test_restarter.py ...... > > =========================== 6 passed in 0.36 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 47 items / 1 skipped > > src/test/python/apache/aurora/client/api/test_scheduler_client.py > ............................................... > > ===================== 47 passed, 1 skipped in 3.60 seconds > ===================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 20 items > > src/test/python/apache/aurora/client/api/test_instance_watcher.py ........ > src/test/python/apache/aurora/client/api/test_health_check.py ............ > > ========================== 20 passed in 0.25 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 27 items > > src/test/python/apache/aurora/client/api/test_updater.py > ........................... > > ========================== 27 passed in 0.65 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 6 items > > src/test/python/apache/aurora/client/api/test_quota_check.py ...... > > =========================== 6 passed in 0.15 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 27 items > > src/test/python/apache/aurora/client/api/test_sla.py > ........................... > > ========================== 27 passed in 0.25 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 4 items > > src/test/python/apache/aurora/client/cli/test_bridge.py .... > > =========================== 4 passed in 0.03 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 5 items > > src/test/python/apache/aurora/client/cli/test_help.py ..... > > =========================== 5 passed in 0.51 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 27 items > > src/test/python/apache/aurora/client/cli/test_cancel_update.py .. > src/test/python/apache/aurora/client/cli/test_create.py .... > src/test/python/apache/aurora/client/cli/test_diff.py ... > src/test/python/apache/aurora/client/cli/test_kill.py ..... > src/test/python/apache/aurora/client/cli/test_restart.py ... > src/test/python/apache/aurora/client/cli/test_status.py ....... > src/test/python/apache/aurora/client/cli/test_update.py ... > > ========================== 27 passed in 1.69 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 2 items > > src/test/python/apache/aurora/client/cli/test_plugins.py .. > > =========================== 2 passed in 0.49 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 3 items > > src/test/python/apache/aurora/client/cli/test_quota.py ... > > =========================== 3 passed in 0.49 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 5 items > > src/test/python/apache/aurora/client/cli/test_sla.py ..... > > =========================== 5 passed in 0.51 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 2 items > > src/test/python/apache/aurora/client/cli/test_task_run.py .. > > =========================== 2 passed in 0.50 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 13 items > > src/test/python/apache/aurora/client/commands/test_admin_sla.py ............. > > ========================== 13 passed in 0.50 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 26 items > > src/test/python/apache/aurora/client/commands/test_cancel_update.py .. > src/test/python/apache/aurora/client/commands/test_create.py ...... > src/test/python/apache/aurora/client/commands/test_diff.py ... > src/test/python/apache/aurora/client/commands/test_kill.py .... > src/test/python/apache/aurora/client/commands/test_listjobs.py .. > src/test/python/apache/aurora/client/commands/test_restart.py ... > src/test/python/apache/aurora/client/commands/test_status.py ... > src/test/python/apache/aurora/client/commands/test_update.py ... > > ========================== 26 passed in 1.32 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 3 items > > src/test/python/apache/aurora/client/commands/test_hooks.py ... > > =========================== 3 passed in 1.03 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 4 items > > src/test/python/apache/aurora/client/commands/test_maintenance.py .... > > =========================== 4 passed in 0.46 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 1 items > > src/test/python/apache/aurora/client/commands/test_run.py . > > =========================== 1 passed in 0.45 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 1 items > > src/test/python/apache/aurora/client/commands/test_ssh.py . > > =========================== 1 passed in 0.46 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 12 items > > src/test/python/apache/aurora/client/hooks/test_hooked_api.py ............ > > ========================== 12 passed in 0.46 seconds > =========================== > ============================= test session starts > ============================== > platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 > collected 4 items > > src/test/python/apache/aurora/client/hooks/test_non_hooked_api.py .... > > =========================== 4 passed in 0.42 seconds > =========================== > Build operating on targets: > OrderedSet([PythonTestSuite(src/test/python/apache/aurora/client/BUILD:all)]) > src.test.python.apache.aurora.client.api.disambiguator > ..... SUCCESS > src.test.python.apache.aurora.client.api.instance_watcher > ..... SUCCESS > src.test.python.apache.aurora.client.api.job_monitor > ..... SUCCESS > src.test.python.apache.aurora.client.api.quota_check > ..... SUCCESS > src.test.python.apache.aurora.client.api.restarter > ..... SUCCESS > src.test.python.apache.aurora.client.api.scheduler_client > ..... SUCCESS > src.test.python.apache.aurora.client.api.sla > ..... SUCCESS > src.test.python.apache.aurora.client.api.updater > ..... SUCCESS > src.test.python.apache.aurora.client.binding_helper > ..... SUCCESS > src.test.python.apache.aurora.client.cli.bridge > ..... SUCCESS > src.test.python.apache.aurora.client.cli.help > ..... SUCCESS > src.test.python.apache.aurora.client.cli.job > ..... SUCCESS > src.test.python.apache.aurora.client.cli.plugins > ..... SUCCESS > src.test.python.apache.aurora.client.cli.quota > ..... SUCCESS > src.test.python.apache.aurora.client.cli.sla > ..... SUCCESS > src.test.python.apache.aurora.client.cli.task > ..... SUCCESS > src.test.python.apache.aurora.client.commands.admin > ..... SUCCESS > src.test.python.apache.aurora.client.commands.core > ..... SUCCESS > src.test.python.apache.aurora.client.commands.hooks > ..... SUCCESS > src.test.python.apache.aurora.client.commands.maintenance > ..... SUCCESS > src.test.python.apache.aurora.client.commands.run > ..... SUCCESS > src.test.python.apache.aurora.client.commands.ssh > ..... SUCCESS > src.test.python.apache.aurora.client.config > ..... SUCCESS > src.test.python.apache.aurora.client.hooks.hooked_api > ..... SUCCESS > src.test.python.apache.aurora.client.hooks.non_hooked_api > ..... SUCCESS > > > Thanks, > > Mark Chu-Carroll > >