> On April 24, 2014, 8:15 p.m., Mark Chu-Carroll wrote:
> > src/main/python/apache/aurora/client/cli/__init__.py, line 344
> > <https://reviews.apache.org/r/20687/diff/1/?file=567983#file567983line344>
> >
> >     Different cases.
> >     
> >     A command hook can signal that a command shouldn't be executed, and 
> > return the exit code that should be returned to the shell. It's intended to 
> > signal that there wasn't an error executing the hook, but that the hook 
> > requested that the command be aborted. 
> >     
> >     The hook can also signal an exception, which means that there was an 
> > error in the hook.
> >
> 
> David McLaughlin wrote:
>     I think exceptions are designed for exactly this... the hook authors can 
> also give their own error messages.
> 
> David McLaughlin wrote:
>     I'm not sure I understand why the distinction between an error in the 
> hook and a request to stop the command is important. Why not just ask the 
> hook to throw a special exception type? If you're adamant about error codes, 
> how would they give a reason for preventing the command running?

I still think that there's an important difference between an error, and a 
normal return.

Hook writers can opt to just use exceptions, and the code will handle it 
correctly if they do. But the plugin code is supposed to look as much as 
possible like it's running as part of a verb implementation. Verbs return 
status codes to the shell when they finish; this is following the same model.

The design doc that we ran by the team and the dev mailing list specified this 
behavior, and I'm still not seeing why it should be removed.


- Mark


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20687/#review41420
-----------------------------------------------------------


On April 24, 2014, 8:17 p.m., Mark Chu-Carroll wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20687/
> -----------------------------------------------------------
> 
> (Updated April 24, 2014, 8:17 p.m.)
> 
> 
> Review request for Aurora, David McLaughlin and Suman Karumuri.
> 
> 
> Bugs: aurora-270
>     https://issues.apache.org/jira/browse/aurora-270
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> Stage 1 of implementing command hooks for aurora v2.
> 
> This change includes:
> (1) The ability to add hard-wired hooks, by registering them in 
> ConfigurationPlugins
>   compiled into a pex;
> (2) Dynamically loaded plugins, loaded from plugin files.
> 
> The dynamically loaded plugins are *not* currently active outside of tests.
> 
> The second stage of this change will activate dynamically loaded plugins, and
> provide a mechanism to allow privileged users to override hooks.
> 
> 
> Diffs
> -----
> 
>   src/main/python/apache/aurora/client/cli/BUILD 
> 17cdc287875b5f0832064a6441f33fc9837fc79b 
>   src/main/python/apache/aurora/client/cli/__init__.py 
> 5a10328e49f0128965aed73b9c167324dfcfde0f 
>   src/main/python/apache/aurora/client/cli/command_hooks.py PRE-CREATION 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 0534bdf72a332caa606dd3a7ca743a59e03738ef 
>   src/test/python/apache/aurora/client/cli/AuroraHooks PRE-CREATION 
>   src/test/python/apache/aurora/client/cli/BUILD 
> 34fdb47baa647b9c3bd149ff2710b175c7435dae 
>   src/test/python/apache/aurora/client/cli/test_command_hooks.py PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/20687/diff/
> 
> 
> Testing
> -------
> 
> [sun-wukong incubator-aurora (command_hooks)]$ ./pants 
> src/test/python/apache/aurora/client/cli:all
> Build operating on targets: 
> OrderedSet([PythonTestSuite(src/test/python/apache/aurora/client/cli/BUILD:all)])
> ================================================= 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 4 items
> 
> src/test/python/apache/aurora/client/cli/test_command_hooks.py ....
> 
> =============================================== 4 passed in 0.58 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.52 seconds 
> ===============================================
> ================================================= test session starts 
> ==================================================
> platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2
> collected 36 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_open.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 ...
> 
> ============================================== 36 passed in 1.87 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/cli/test_logging.py .
> 
> =============================================== 1 passed in 0.62 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.53 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_quota.py ....
> 
> =============================================== 4 passed in 0.55 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.56 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.54 seconds 
> ===============================================
> src.test.python.apache.aurora.client.cli.bridge                               
>   .....   SUCCESS
> src.test.python.apache.aurora.client.cli.command_hooks                        
>   .....   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.logging                              
>   .....   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
> [sun-wukong incubator-aurora (command_hooks)]$
> 
> 
> Thanks,
> 
> Mark Chu-Carroll
> 
>

Reply via email to