> On Feb. 6, 2014, 5:36 p.m., Mark Chu-Carroll wrote:
> > src/main/python/apache/aurora/client/cli/__init__.py, line 149
> > <https://reviews.apache.org/r/17270/diff/3/?file=456886#file456886line149>
> >
> >     That's actually the way that I originally wrote it, and wickman wanted 
> > me to change it to this.
> 
> Jonathan Boulle wrote:
>     Well, not quite - he proposed something like
>     
>     def register_noun(self, noun):
>       if self.registered:
>         raise self.Error('Cannot add new nouns after registration')
>     
>     which is a different behaviour from what's here, although I don't 
> understand what he was trying to achieve...
>     
>     
>     Overall I guess I'm unclear on the exact semantics you're trying to 
> implement. Should register_nouns only be callable once?

register_nouns should be idempotent; calling it repeatedly is a waste of time, 
but it shouldn't harm anything.

The point of the check is to allowed a delayed initialization of the verbs map. 
The idea is that I can imagine usecases where a commandline needs to look at 
the environment in order to determine whether or not to register a particular 
noun. For example, I can imagine a situation where packer is an optional 
component of aurora. Then the aurora client starts up, and checks to see if 
there's a packer, and if so, it would register the package noun, otherwise it 
wouldn't. That kind of test relies on other pieces of the system being 
initialized - for example, it could rely on CLUSTERS being properly populated 
for the environment, so that it can examine the clusters and see if any of them 
have a packer.  So I don't want to eagerly run noun registration before other 
things have been initialized. So all that this is trying to do is delay the 
population of the nouns until they're needed. (That's why I mostly followed 
Brian's suggestion, but didn't include the raising of an error, because I don
 't care if it gets called more than once; I just care that it doesn't get 
called until after other things have been initialized.)

I've tried a change that gets rid of the "registered" field which I'll upload 
shortly; hopefully that's better.


- Mark


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


On Jan. 30, 2014, 4:03 p.m., Mark Chu-Carroll wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/17270/
> -----------------------------------------------------------
> 
> (Updated Jan. 30, 2014, 4:03 p.m.)
> 
> 
> Review request for Aurora, Bill Farner and Brian Wickman.
> 
> 
> Bugs: aurora-76
>     https://issues.apache.org/jira/browse/aurora-76
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> Bridge framework for client v2.
> 
> 
> Diffs
> -----
> 
>   src/main/python/apache/aurora/client/bin/BUILD 
> 46695b423663c8e970773714c3dcb7de1046a9fb 
>   src/main/python/apache/aurora/client/cli/BUILD 
> 8828c1e68b3ae7793fb0bb081730e0ff8fff5ed1 
>   src/main/python/apache/aurora/client/cli/__init__.py 
> 20ecbcf5d3a868f91922244162b516a66d24d32b 
>   src/main/python/apache/aurora/client/cli/bridge.py PRE-CREATION 
>   src/main/python/apache/aurora/client/cli/client.py PRE-CREATION 
>   src/test/python/apache/aurora/client/cli/BUILD 
> f9ebe0cf626a040aa67654faea07b8902e558282 
>   src/test/python/apache/aurora/client/cli/test_bridge.py PRE-CREATION 
>   src/test/python/apache/aurora/client/cli/test_create.py 
> 64eb51be32f33de7d67962ff9300e64820a37baf 
>   src/test/python/apache/aurora/client/cli/test_diff.py 
> 32433c17322e52c4ffb005bcc620fba56e728879 
>   src/test/python/apache/aurora/client/cli/test_kill.py 
> 714d5fbeebaaba6cede438c40b3b370d0ee99934 
>   src/test/python/apache/aurora/client/cli/test_status.py 
> efcf164682a56294863a2aec916b9382a50032b7 
> 
> Diff: https://reviews.apache.org/r/17270/diff/
> 
> 
> Testing
> -------
> 
> [sun-wukong incubator-aurora (bridge)]$ ./pants 
> src/test/python/apache/aurora/client:all
> Build operating on targets: 
> OrderedSet([PythonTestSuite(src/test/python/apache/aurora/client/BUILD:all)])
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 2 items
> 
> src/test/python/apache/aurora/client/test_binding_helper.py ..
> 
> ================================= 2 passed in 0.31 seconds 
> ==================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 6 items
> 
> src/test/python/apache/aurora/client/test_config.py ......
> 
> ================================= 6 passed in 0.41 seconds 
> ==================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 6 items
> 
> src/test/python/apache/aurora/client/api/test_disambiguator.py ......
> 
> ================================= 6 passed in 0.28 seconds 
> ==================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 1 items
> 
> src/test/python/apache/aurora/client/api/test_job_monitor.py .
> 
> ================================= 1 passed in 0.23 seconds 
> ==================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 6 items
> 
> src/test/python/apache/aurora/client/api/test_restarter.py ......
> 
> ================================= 6 passed in 0.22 seconds 
> ==================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 47 items / 1 skipped
> 
> src/test/python/apache/aurora/client/api/test_scheduler_client.py 
> ...............................................
> 
> =========================== 47 passed, 1 skipped in 0.60 seconds 
> ============================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> 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.7.2 -- pytest-2.5.1
> collected 26 items
> 
> src/test/python/apache/aurora/client/api/test_updater.py 
> ..........................
> 
> ================================= 26 passed in 0.44 seconds 
> =================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 6 items
> 
> src/test/python/apache/aurora/client/api/test_quota_check.py ......
> 
> ================================= 6 passed in 0.10 seconds 
> ==================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 17 items
> 
> src/test/python/apache/aurora/client/cli/test_create.py ....
> src/test/python/apache/aurora/client/cli/test_kill.py .....
> src/test/python/apache/aurora/client/cli/test_status.py .....
> src/test/python/apache/aurora/client/cli/test_diff.py ...
> 
> ================================= 17 passed in 0.66 seconds 
> =================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 4 items
> 
> src/test/python/apache/aurora/client/cli/test_bridge.py ....
> 
> ================================= 4 passed in 0.08 seconds 
> ==================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 24 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 ...
> 
> ================================= 24 passed in 1.31 seconds 
> =================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 1 items
> 
> src/test/python/apache/aurora/client/commands/test_run.py .
> 
> ================================= 1 passed in 0.36 seconds 
> ==================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 1 items
> 
> src/test/python/apache/aurora/client/commands/test_ssh.py .
> 
> ================================= 1 passed in 0.30 seconds 
> ==================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 12 items
> 
> src/test/python/apache/aurora/client/hooks/test_hooked_api.py ............
> 
> ================================= 12 passed in 0.23 seconds 
> =================================
> ==================================== test session starts 
> ====================================
> platform darwin -- Python 2.7.2 -- pytest-2.5.1
> collected 4 items
> 
> src/test/python/apache/aurora/client/hooks/test_non_hooked_api.py ....
> 
> ================================= 4 passed in 0.23 seconds 
> ==================================
> 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.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.job                                  
>   .....   SUCCESS
> src.test.python.apache.aurora.client.commands.core                            
>   .....   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
> [sun-wukong incubator-aurora (bridge)]$
> 
> V1 COMMAND:
> [sun-wukong incubator-aurora (bridge)]$ ./dist/client.pex version
> Aurora client build info:
>   sha: 18afec3ae3a5d896f69984784a1dbc6e0e743e44
>   date: Thursday Jan 23, 2014
> Aurora API version: APIVersion(major=3)
> 
> V2 COMMAND:
> [sun-wukong incubator-aurora (bridge)]$ ./dist/client.pex job status
> usage: client.pex job status [-h] [--json] jobspec
> client.pex job status: error: too few arguments
> 
> 
> Thanks,
> 
> Mark Chu-Carroll
> 
>

Reply via email to