Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-11-11 Thread Zameer Manji

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



I don't have the bandwidth to review this. Please remove me from the reviewers 
list since is seems jcohen and serb are on it.

- Zameer Manji


On Nov. 11, 2016, 2:13 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Nov. 11, 2016, 2:13 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Stephan Erb, Brian Wickman, and 
> Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> vagrant@aurora:~$ aurora job inspect 
> devcluster/www-data/devel/cron_hello_jing /vagrant/cron_hello_jing.aurora 
> --write-json | tee /tmp/test.json
> ```
> {"environment": "devel", "health_check_config": {"initial_interval_secs": 
> 15.0, "health_checker": {"http": {"expected_response_code": 0, "endpoint": 
> "/health", "expected_response": "ok"}}, "interval_secs": 10.0, 
> "timeout_secs": 1.0, "max_consecutive_failures": 0}, "cluster": "devcluster", 
> "cron_schedule": "*/10 * * * *", "service": false, "update_config": 
> {"wait_for_batch_completion": false, "batch_size": 1, "watch_secs": 45, 
> "rollback_on_failure": true, "max_per_shard_failures": 0, 
> "max_total_failures": 0}, "name": "cron_hello_jing", "max_task_failures": 1, 
> "cron_collision_policy": "CANCEL_NEW", "enable_hooks": false, "instances": 1, 
> "task": {"processes": [{"daemon": false, "name": "hello_jing", "ephemeral": 
> false, "max_failures": 1, "min_duration": 5, "cmdline": "echo 'cron hello 
> jing'", "final": false}], "name": "cron_hello_jing", "finalization_wait": 30, 
> "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 
> 8388608, "ram": 1048576, "cpu": 1.0}, "constraints":
  []}, "production": false, "role": "www-data", "tier": "preemptible", 
"lifecycle": {"http": {"graceful_shutdown_endpoint": "/quitquitquit", "port": 
"health", "shutdown_endpoint": "/abortabortabort"}}, "priority": 0}
> ```
> 
> 
> vagrant@aurora:~$ aurora job inspect 
> devcluster/www-data/devel/cron_hello_jing /tmp/test.json --read-json
> ```
> Job level information
>   name:   'cron_hello_jing'
>   role:   'www-data'
>   cluster:'devcluster'
>   instances:  '1'
>   cron:
> schedule: '*/10 * * * *'
> policy:   'CANCEL_NEW'
>   service:False
>   production: False
> 
> Task level information
>   name: 'cron_hello_jing'
> 
> Process 'hello_jing':
>   cmdline:
> echo 'cron hello jing'
> ```
> 
> 
> Thanks,
> 
> Jing Chen
> 
>



Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-11-11 Thread Aurora ReviewBot

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


Ship it!




Master (8a9939f) is green with this patch.
  ./build-support/jenkins/build.sh

I will refresh this build result if you post a review containing "@ReviewBot 
retry"

- Aurora ReviewBot


On Nov. 11, 2016, 10:13 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Nov. 11, 2016, 10:13 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Stephan Erb, Brian Wickman, and 
> Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> vagrant@aurora:~$ aurora job inspect 
> devcluster/www-data/devel/cron_hello_jing /vagrant/cron_hello_jing.aurora 
> --write-json | tee /tmp/test.json
> ```
> {"environment": "devel", "health_check_config": {"initial_interval_secs": 
> 15.0, "health_checker": {"http": {"expected_response_code": 0, "endpoint": 
> "/health", "expected_response": "ok"}}, "interval_secs": 10.0, 
> "timeout_secs": 1.0, "max_consecutive_failures": 0}, "cluster": "devcluster", 
> "cron_schedule": "*/10 * * * *", "service": false, "update_config": 
> {"wait_for_batch_completion": false, "batch_size": 1, "watch_secs": 45, 
> "rollback_on_failure": true, "max_per_shard_failures": 0, 
> "max_total_failures": 0}, "name": "cron_hello_jing", "max_task_failures": 1, 
> "cron_collision_policy": "CANCEL_NEW", "enable_hooks": false, "instances": 1, 
> "task": {"processes": [{"daemon": false, "name": "hello_jing", "ephemeral": 
> false, "max_failures": 1, "min_duration": 5, "cmdline": "echo 'cron hello 
> jing'", "final": false}], "name": "cron_hello_jing", "finalization_wait": 30, 
> "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 
> 8388608, "ram": 1048576, "cpu": 1.0}, "constraints":
  []}, "production": false, "role": "www-data", "tier": "preemptible", 
"lifecycle": {"http": {"graceful_shutdown_endpoint": "/quitquitquit", "port": 
"health", "shutdown_endpoint": "/abortabortabort"}}, "priority": 0}
> ```
> 
> 
> vagrant@aurora:~$ aurora job inspect 
> devcluster/www-data/devel/cron_hello_jing /tmp/test.json --read-json
> ```
> Job level information
>   name:   'cron_hello_jing'
>   role:   'www-data'
>   cluster:'devcluster'
>   instances:  '1'
>   cron:
> schedule: '*/10 * * * *'
> policy:   'CANCEL_NEW'
>   service:False
>   production: False
> 
> Task level information
>   name: 'cron_hello_jing'
> 
> Process 'hello_jing':
>   cmdline:
> echo 'cron hello jing'
> ```
> 
> 
> Thanks,
> 
> Jing Chen
> 
>



Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-11-11 Thread Jing Chen

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

(Updated Nov. 11, 2016, 10:13 a.m.)


Review request for Aurora, Joshua Cohen, Stephan Erb, Brian Wickman, and Zameer 
Manji.


Bugs: AURORA-1504
https://issues.apache.org/jira/browse/AURORA-1504


Repository: aurora


Description
---

aurora job inspect should have a --write-json option


Diffs (updated)
-

  src/main/python/apache/aurora/client/cli/jobs.py 
87fbf13f8e5955b30436f8d871b548275f009893 
  src/test/python/apache/aurora/client/cli/test_inspect.py 
fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 

Diff: https://reviews.apache.org/r/53114/diff/


Testing
---

vagrant@aurora:~$ aurora job inspect devcluster/www-data/devel/cron_hello_jing 
/vagrant/cron_hello_jing.aurora --write-json | tee /tmp/test.json
```
{"environment": "devel", "health_check_config": {"initial_interval_secs": 15.0, 
"health_checker": {"http": {"expected_response_code": 0, "endpoint": "/health", 
"expected_response": "ok"}}, "interval_secs": 10.0, "timeout_secs": 1.0, 
"max_consecutive_failures": 0}, "cluster": "devcluster", "cron_schedule": "*/10 
* * * *", "service": false, "update_config": {"wait_for_batch_completion": 
false, "batch_size": 1, "watch_secs": 45, "rollback_on_failure": true, 
"max_per_shard_failures": 0, "max_total_failures": 0}, "name": 
"cron_hello_jing", "max_task_failures": 1, "cron_collision_policy": 
"CANCEL_NEW", "enable_hooks": false, "instances": 1, "task": {"processes": 
[{"daemon": false, "name": "hello_jing", "ephemeral": false, "max_failures": 1, 
"min_duration": 5, "cmdline": "echo 'cron hello jing'", "final": false}], 
"name": "cron_hello_jing", "finalization_wait": 30, "max_failures": 1, 
"max_concurrency": 0, "resources": {"gpu": 0, "disk": 8388608, "ram": 1048576, 
"cpu": 1.0}, "constraints": [
 ]}, "production": false, "role": "www-data", "tier": "preemptible", 
"lifecycle": {"http": {"graceful_shutdown_endpoint": "/quitquitquit", "port": 
"health", "shutdown_endpoint": "/abortabortabort"}}, "priority": 0}
```


vagrant@aurora:~$ aurora job inspect devcluster/www-data/devel/cron_hello_jing 
/tmp/test.json --read-json
```
Job level information
  name:   'cron_hello_jing'
  role:   'www-data'
  cluster:'devcluster'
  instances:  '1'
  cron:
schedule: '*/10 * * * *'
policy:   'CANCEL_NEW'
  service:False
  production: False

Task level information
  name: 'cron_hello_jing'

Process 'hello_jing':
  cmdline:
echo 'cron hello jing'
```


Thanks,

Jing Chen



Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-11-11 Thread Stephan Erb

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


Ship it!




Looks good to me. Thanks for the update!


src/main/python/apache/aurora/client/cli/jobs.py (line 238)


As this method is only called by the class itself, it should be be called 
`_render_config_pretty`.


- Stephan Erb


On Nov. 11, 2016, 10:34 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Nov. 11, 2016, 10:34 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Stephan Erb, Brian Wickman, and 
> Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> vagrant@aurora:~$ aurora job inspect 
> devcluster/www-data/devel/cron_hello_jing /vagrant/cron_hello_jing.aurora 
> --write-json | tee /tmp/test.json
> ```
> {"environment": "devel", "health_check_config": {"initial_interval_secs": 
> 15.0, "health_checker": {"http": {"expected_response_code": 0, "endpoint": 
> "/health", "expected_response": "ok"}}, "interval_secs": 10.0, 
> "timeout_secs": 1.0, "max_consecutive_failures": 0}, "cluster": "devcluster", 
> "cron_schedule": "*/10 * * * *", "service": false, "update_config": 
> {"wait_for_batch_completion": false, "batch_size": 1, "watch_secs": 45, 
> "rollback_on_failure": true, "max_per_shard_failures": 0, 
> "max_total_failures": 0}, "name": "cron_hello_jing", "max_task_failures": 1, 
> "cron_collision_policy": "CANCEL_NEW", "enable_hooks": false, "instances": 1, 
> "task": {"processes": [{"daemon": false, "name": "hello_jing", "ephemeral": 
> false, "max_failures": 1, "min_duration": 5, "cmdline": "echo 'cron hello 
> jing'", "final": false}], "name": "cron_hello_jing", "finalization_wait": 30, 
> "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 
> 8388608, "ram": 1048576, "cpu": 1.0}, "constraints":
  []}, "production": false, "role": "www-data", "tier": "preemptible", 
"lifecycle": {"http": {"graceful_shutdown_endpoint": "/quitquitquit", "port": 
"health", "shutdown_endpoint": "/abortabortabort"}}, "priority": 0}
> ```
> 
> 
> vagrant@aurora:~$ aurora job inspect 
> devcluster/www-data/devel/cron_hello_jing /tmp/test.json --read-json
> ```
> Job level information
>   name:   'cron_hello_jing'
>   role:   'www-data'
>   cluster:'devcluster'
>   instances:  '1'
>   cron:
> schedule: '*/10 * * * *'
> policy:   'CANCEL_NEW'
>   service:False
>   production: False
> 
> Task level information
>   name: 'cron_hello_jing'
> 
> Process 'hello_jing':
>   cmdline:
> echo 'cron hello jing'
> ```
> 
> 
> Thanks,
> 
> Jing Chen
> 
>



Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-11-11 Thread Aurora ReviewBot

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


Ship it!




Master (8a9939f) is green with this patch.
  ./build-support/jenkins/build.sh

I will refresh this build result if you post a review containing "@ReviewBot 
retry"

- Aurora ReviewBot


On Nov. 11, 2016, 9:34 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Nov. 11, 2016, 9:34 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Stephan Erb, Brian Wickman, and 
> Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> vagrant@aurora:~$ aurora job inspect 
> devcluster/www-data/devel/cron_hello_jing /vagrant/cron_hello_jing.aurora 
> --write-json | tee /tmp/test.json
> ```
> {"environment": "devel", "health_check_config": {"initial_interval_secs": 
> 15.0, "health_checker": {"http": {"expected_response_code": 0, "endpoint": 
> "/health", "expected_response": "ok"}}, "interval_secs": 10.0, 
> "timeout_secs": 1.0, "max_consecutive_failures": 0}, "cluster": "devcluster", 
> "cron_schedule": "*/10 * * * *", "service": false, "update_config": 
> {"wait_for_batch_completion": false, "batch_size": 1, "watch_secs": 45, 
> "rollback_on_failure": true, "max_per_shard_failures": 0, 
> "max_total_failures": 0}, "name": "cron_hello_jing", "max_task_failures": 1, 
> "cron_collision_policy": "CANCEL_NEW", "enable_hooks": false, "instances": 1, 
> "task": {"processes": [{"daemon": false, "name": "hello_jing", "ephemeral": 
> false, "max_failures": 1, "min_duration": 5, "cmdline": "echo 'cron hello 
> jing'", "final": false}], "name": "cron_hello_jing", "finalization_wait": 30, 
> "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 
> 8388608, "ram": 1048576, "cpu": 1.0}, "constraints":
  []}, "production": false, "role": "www-data", "tier": "preemptible", 
"lifecycle": {"http": {"graceful_shutdown_endpoint": "/quitquitquit", "port": 
"health", "shutdown_endpoint": "/abortabortabort"}}, "priority": 0}
> ```
> 
> 
> vagrant@aurora:~$ aurora job inspect 
> devcluster/www-data/devel/cron_hello_jing /tmp/test.json --read-json
> ```
> Job level information
>   name:   'cron_hello_jing'
>   role:   'www-data'
>   cluster:'devcluster'
>   instances:  '1'
>   cron:
> schedule: '*/10 * * * *'
> policy:   'CANCEL_NEW'
>   service:False
>   production: False
> 
> Task level information
>   name: 'cron_hello_jing'
> 
> Process 'hello_jing':
>   cmdline:
> echo 'cron hello jing'
> ```
> 
> 
> Thanks,
> 
> Jing Chen
> 
>



Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-11-11 Thread Jing Chen

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

(Updated Nov. 11, 2016, 9:34 a.m.)


Review request for Aurora, Joshua Cohen, Stephan Erb, Brian Wickman, and Zameer 
Manji.


Bugs: AURORA-1504
https://issues.apache.org/jira/browse/AURORA-1504


Repository: aurora


Description
---

aurora job inspect should have a --write-json option


Diffs (updated)
-

  src/main/python/apache/aurora/client/cli/jobs.py 
87fbf13f8e5955b30436f8d871b548275f009893 
  src/test/python/apache/aurora/client/cli/test_inspect.py 
fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 

Diff: https://reviews.apache.org/r/53114/diff/


Testing (updated)
---

vagrant@aurora:~$ aurora job inspect devcluster/www-data/devel/cron_hello_jing 
/vagrant/cron_hello_jing.aurora --write-json | tee /tmp/test.json
```
{"environment": "devel", "health_check_config": {"initial_interval_secs": 15.0, 
"health_checker": {"http": {"expected_response_code": 0, "endpoint": "/health", 
"expected_response": "ok"}}, "interval_secs": 10.0, "timeout_secs": 1.0, 
"max_consecutive_failures": 0}, "cluster": "devcluster", "cron_schedule": "*/10 
* * * *", "service": false, "update_config": {"wait_for_batch_completion": 
false, "batch_size": 1, "watch_secs": 45, "rollback_on_failure": true, 
"max_per_shard_failures": 0, "max_total_failures": 0}, "name": 
"cron_hello_jing", "max_task_failures": 1, "cron_collision_policy": 
"CANCEL_NEW", "enable_hooks": false, "instances": 1, "task": {"processes": 
[{"daemon": false, "name": "hello_jing", "ephemeral": false, "max_failures": 1, 
"min_duration": 5, "cmdline": "echo 'cron hello jing'", "final": false}], 
"name": "cron_hello_jing", "finalization_wait": 30, "max_failures": 1, 
"max_concurrency": 0, "resources": {"gpu": 0, "disk": 8388608, "ram": 1048576, 
"cpu": 1.0}, "constraints": [
 ]}, "production": false, "role": "www-data", "tier": "preemptible", 
"lifecycle": {"http": {"graceful_shutdown_endpoint": "/quitquitquit", "port": 
"health", "shutdown_endpoint": "/abortabortabort"}}, "priority": 0}
```


vagrant@aurora:~$ aurora job inspect devcluster/www-data/devel/cron_hello_jing 
/tmp/test.json --read-json
```
Job level information
  name:   'cron_hello_jing'
  role:   'www-data'
  cluster:'devcluster'
  instances:  '1'
  cron:
schedule: '*/10 * * * *'
policy:   'CANCEL_NEW'
  service:False
  production: False

Task level information
  name: 'cron_hello_jing'

Process 'hello_jing':
  cmdline:
echo 'cron hello jing'
```


Thanks,

Jing Chen



Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-11-07 Thread Stephan Erb


> On Nov. 4, 2016, 3:22 p.m., Stephan Erb wrote:
> > src/main/python/apache/aurora/client/cli/jobs.py, lines 291-337
> > 
> >
> > Having a manual json assembly here is brittle.  Whenever we change 
> > something in the pystachio schema we have to make sure we update this place 
> > as well. This is asking for trouble down the road.
> > 
> > I would propose to replace this with a single call of the existing 
> > pystachio json serialization method instead:
> > 
> > ```
> > config.raw().json_dumps()
> > ```
> > 
> > A file written using this is then also suitable for ingestion via our 
> > `--read-json` methods.  For example:
> > 
> > ```
> > aurora job inspect --read-json devcluster/www-data/prod/hello 
> > hello_world.json
> > ```
> 
> Jing Chen wrote:
> should we do anything on non-json rendering side? Per your concerns, 
> changes in the pystachio schema might also force us to update the non-json 
> rendering.

The non-json side cannot be automatically parsed again into a working pystachio 
structure. This means that changes here would not affect correctnes but only 
completness. I would therefore be OK with leaving the non-json rending the way 
it is right now.


- Stephan


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


On Oct. 25, 2016, 4:14 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Oct. 25, 2016, 4:14 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> * For configuration for a job as:
> ```
> pkg_path = '/vagrant/hello.py'
> 
> install = Process(
> name='fetch package',
> cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))
> 
> runner = Process(
> name='hello jing',
> ephemeral = True,
> cmdline='python -u hello.py')
> 
> hello_task = SequentialTask(
> name='hello task',
> processes=[install, runner],
> resources=Resources(cpu=1, ram=1*MB, disk=8*MB))
> 
> jobs = [
> Service(cluster='devcluster',
> role='www-data',
> environment='devel',
> name='hello_jing',
> task=hello_task,
> constraints = {
>   'host':'limit:2',
>   'rack':'limit:1'
> })
> ]
> ```
> command 'aurora job inspect devcluster/www-data/devel/hello_jing 
> /vagrant/hello.aurora --write-json' returns:
> ```
> {
>   "job": {
> "name": "hello_jing",
> "role": "www-data",
> "cluster": "devcluster",
> "instances": "1",
> "constraints": [
>   {
> "host": "limit:2"
>   },
>   {
> "rack": "limit:1"
>   }
> ],
> "service": true,
> "production": false
>   },
>   "task": {
> "name": "hello task",
> "constraints": [
>   "fetch package < hello jing"
> ],
> "processes": [
>   {
> "name": "fetch package",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "cp /vagrant/hello.py . && chmod u+x hello.py"
> ]
>   },
>   {
> "name": "hello jing",
> "daemon": false,
> "ephemeral": true,
> "final": false,
> "cmdline": [
>   "python -u hello.py"
> ]
>   }
> ]
>   }
> }
> 
> ```
> 
> * For configuration for a cron job as:
> ```
> jobs = [
>   Job(
> cluster = 'devcluster',
> role = 'www-data',
> environment = 'devel',
> name = 'cron_hello_jing',
> cron_schedule = '*/10 * * * *',
> cron_collision_policy='CANCEL_NEW',
> task = Task(
>   name="cron_hello_jing",
>   processes=[Process(name="hello_jing",
>cmdline="echo 'cron hello jing'")],
>   resources=Resources(cpu=1, ram=1*MB, disk=8*MB)
> )
>   )
> ]
> ```
> command aurora job inspect devcluster/www-data/devel/cron_hello_jing 
> /vagrant/cron_hello_world.aurora --write-json returns:
> ```
> {
>   "job": {
> "name": "cron_hello_jing",
> "role": "www-data",
> "cluster": "devcluster",
> "instances": "1",
> "cron": {
>  

Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-11-07 Thread Jing Chen


> On Nov. 4, 2016, 2:22 p.m., Stephan Erb wrote:
> > src/main/python/apache/aurora/client/cli/jobs.py, lines 291-337
> > 
> >
> > Having a manual json assembly here is brittle.  Whenever we change 
> > something in the pystachio schema we have to make sure we update this place 
> > as well. This is asking for trouble down the road.
> > 
> > I would propose to replace this with a single call of the existing 
> > pystachio json serialization method instead:
> > 
> > ```
> > config.raw().json_dumps()
> > ```
> > 
> > A file written using this is then also suitable for ingestion via our 
> > `--read-json` methods.  For example:
> > 
> > ```
> > aurora job inspect --read-json devcluster/www-data/prod/hello 
> > hello_world.json
> > ```

should we do anything on non-json rendering side? Per your concerns, changes in 
the pystachio schema might also force us to update the non-json rendering.


- Jing


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


On Oct. 25, 2016, 2:14 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Oct. 25, 2016, 2:14 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> * For configuration for a job as:
> ```
> pkg_path = '/vagrant/hello.py'
> 
> install = Process(
> name='fetch package',
> cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))
> 
> runner = Process(
> name='hello jing',
> ephemeral = True,
> cmdline='python -u hello.py')
> 
> hello_task = SequentialTask(
> name='hello task',
> processes=[install, runner],
> resources=Resources(cpu=1, ram=1*MB, disk=8*MB))
> 
> jobs = [
> Service(cluster='devcluster',
> role='www-data',
> environment='devel',
> name='hello_jing',
> task=hello_task,
> constraints = {
>   'host':'limit:2',
>   'rack':'limit:1'
> })
> ]
> ```
> command 'aurora job inspect devcluster/www-data/devel/hello_jing 
> /vagrant/hello.aurora --write-json' returns:
> ```
> {
>   "job": {
> "name": "hello_jing",
> "role": "www-data",
> "cluster": "devcluster",
> "instances": "1",
> "constraints": [
>   {
> "host": "limit:2"
>   },
>   {
> "rack": "limit:1"
>   }
> ],
> "service": true,
> "production": false
>   },
>   "task": {
> "name": "hello task",
> "constraints": [
>   "fetch package < hello jing"
> ],
> "processes": [
>   {
> "name": "fetch package",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "cp /vagrant/hello.py . && chmod u+x hello.py"
> ]
>   },
>   {
> "name": "hello jing",
> "daemon": false,
> "ephemeral": true,
> "final": false,
> "cmdline": [
>   "python -u hello.py"
> ]
>   }
> ]
>   }
> }
> 
> ```
> 
> * For configuration for a cron job as:
> ```
> jobs = [
>   Job(
> cluster = 'devcluster',
> role = 'www-data',
> environment = 'devel',
> name = 'cron_hello_jing',
> cron_schedule = '*/10 * * * *',
> cron_collision_policy='CANCEL_NEW',
> task = Task(
>   name="cron_hello_jing",
>   processes=[Process(name="hello_jing",
>cmdline="echo 'cron hello jing'")],
>   resources=Resources(cpu=1, ram=1*MB, disk=8*MB)
> )
>   )
> ]
> ```
> command aurora job inspect devcluster/www-data/devel/cron_hello_jing 
> /vagrant/cron_hello_world.aurora --write-json returns:
> ```
> {
>   "job": {
> "name": "cron_hello_jing",
> "role": "www-data",
> "cluster": "devcluster",
> "instances": "1",
> "cron": {
>   "schedule": "*/10 * * * *",
>   "policy": "CANCEL_NEW"
> },
> "service": false,
> "production": false
>   },
>   "task": {
> "name": "cron_hello_jing",
> "processes": [
>   {
> "name": "hello_jing",
> "daemon": false,
> "ephemeral": 

Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-11-04 Thread Stephan Erb

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




src/main/python/apache/aurora/client/cli/jobs.py (lines 287 - 333)


Having a manual json assembly here is brittle.  Whenever we change 
something in the pystachio schema we have to make sure we update this place as 
well. This is asking for trouble down the road.

I would propose to replace this with a single call of the existing 
pystachio json serialization method instead:

```
config.raw().json_dumps()
```

A file written using this is then also suitable for ingestion via our 
`--read-json` methods.  For example:

```
aurora job inspect --read-json devcluster/www-data/prod/hello 
hello_world.json
```


- Stephan Erb


On Oct. 25, 2016, 4:14 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Oct. 25, 2016, 4:14 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> * For configuration for a job as:
> ```
> pkg_path = '/vagrant/hello.py'
> 
> install = Process(
> name='fetch package',
> cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))
> 
> runner = Process(
> name='hello jing',
> ephemeral = True,
> cmdline='python -u hello.py')
> 
> hello_task = SequentialTask(
> name='hello task',
> processes=[install, runner],
> resources=Resources(cpu=1, ram=1*MB, disk=8*MB))
> 
> jobs = [
> Service(cluster='devcluster',
> role='www-data',
> environment='devel',
> name='hello_jing',
> task=hello_task,
> constraints = {
>   'host':'limit:2',
>   'rack':'limit:1'
> })
> ]
> ```
> command 'aurora job inspect devcluster/www-data/devel/hello_jing 
> /vagrant/hello.aurora --write-json' returns:
> ```
> {
>   "job": {
> "name": "hello_jing",
> "role": "www-data",
> "cluster": "devcluster",
> "instances": "1",
> "constraints": [
>   {
> "host": "limit:2"
>   },
>   {
> "rack": "limit:1"
>   }
> ],
> "service": true,
> "production": false
>   },
>   "task": {
> "name": "hello task",
> "constraints": [
>   "fetch package < hello jing"
> ],
> "processes": [
>   {
> "name": "fetch package",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "cp /vagrant/hello.py . && chmod u+x hello.py"
> ]
>   },
>   {
> "name": "hello jing",
> "daemon": false,
> "ephemeral": true,
> "final": false,
> "cmdline": [
>   "python -u hello.py"
> ]
>   }
> ]
>   }
> }
> 
> ```
> 
> * For configuration for a cron job as:
> ```
> jobs = [
>   Job(
> cluster = 'devcluster',
> role = 'www-data',
> environment = 'devel',
> name = 'cron_hello_jing',
> cron_schedule = '*/10 * * * *',
> cron_collision_policy='CANCEL_NEW',
> task = Task(
>   name="cron_hello_jing",
>   processes=[Process(name="hello_jing",
>cmdline="echo 'cron hello jing'")],
>   resources=Resources(cpu=1, ram=1*MB, disk=8*MB)
> )
>   )
> ]
> ```
> command aurora job inspect devcluster/www-data/devel/cron_hello_jing 
> /vagrant/cron_hello_world.aurora --write-json returns:
> ```
> {
>   "job": {
> "name": "cron_hello_jing",
> "role": "www-data",
> "cluster": "devcluster",
> "instances": "1",
> "cron": {
>   "schedule": "*/10 * * * *",
>   "policy": "CANCEL_NEW"
> },
> "service": false,
> "production": false
>   },
>   "task": {
> "name": "cron_hello_jing",
> "processes": [
>   {
> "name": "hello_jing",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "echo 'cron hello jing'"
> ]
>   }
> ]
>   }
> }
> ```
> 
> 
> Thanks,
> 
> Jing Chen
> 
>



Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-10-24 Thread Aurora ReviewBot

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


Ship it!




Master (7ac639b) is green with this patch.
  ./build-support/jenkins/build.sh

I will refresh this build result if you post a review containing "@ReviewBot 
retry"

- Aurora ReviewBot


On Oct. 25, 2016, 2:14 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Oct. 25, 2016, 2:14 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> * For configuration for a job as:
> ```
> pkg_path = '/vagrant/hello.py'
> 
> install = Process(
> name='fetch package',
> cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))
> 
> runner = Process(
> name='hello jing',
> ephemeral = True,
> cmdline='python -u hello.py')
> 
> hello_task = SequentialTask(
> name='hello task',
> processes=[install, runner],
> resources=Resources(cpu=1, ram=1*MB, disk=8*MB))
> 
> jobs = [
> Service(cluster='devcluster',
> role='www-data',
> environment='devel',
> name='hello_jing',
> task=hello_task,
> constraints = {
>   'host':'limit:2',
>   'rack':'limit:1'
> })
> ]
> ```
> command 'aurora job inspect devcluster/www-data/devel/hello_jing 
> /vagrant/hello.aurora --write-json' returns:
> ```
> {
>   "job": {
> "name": "hello_jing",
> "role": "www-data",
> "cluster": "devcluster",
> "instances": "1",
> "constraints": [
>   {
> "host": "limit:2"
>   },
>   {
> "rack": "limit:1"
>   }
> ],
> "service": true,
> "production": false
>   },
>   "task": {
> "name": "hello task",
> "constraints": [
>   "fetch package < hello jing"
> ],
> "processes": [
>   {
> "name": "fetch package",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "cp /vagrant/hello.py . && chmod u+x hello.py"
> ]
>   },
>   {
> "name": "hello jing",
> "daemon": false,
> "ephemeral": true,
> "final": false,
> "cmdline": [
>   "python -u hello.py"
> ]
>   }
> ]
>   }
> }
> 
> ```
> 
> * For configuration for a cron job as:
> ```
> jobs = [
>   Job(
> cluster = 'devcluster',
> role = 'www-data',
> environment = 'devel',
> name = 'cron_hello_jing',
> cron_schedule = '*/10 * * * *',
> cron_collision_policy='CANCEL_NEW',
> task = Task(
>   name="cron_hello_jing",
>   processes=[Process(name="hello_jing",
>cmdline="echo 'cron hello jing'")],
>   resources=Resources(cpu=1, ram=1*MB, disk=8*MB)
> )
>   )
> ]
> ```
> command aurora job inspect devcluster/www-data/devel/cron_hello_jing 
> /vagrant/cron_hello_world.aurora --write-json returns:
> ```
> {
>   "job": {
> "name": "cron_hello_jing",
> "role": "www-data",
> "cluster": "devcluster",
> "instances": "1",
> "cron": {
>   "schedule": "*/10 * * * *",
>   "policy": "CANCEL_NEW"
> },
> "service": false,
> "production": false
>   },
>   "task": {
> "name": "cron_hello_jing",
> "processes": [
>   {
> "name": "hello_jing",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "echo 'cron hello jing'"
> ]
>   }
> ]
>   }
> }
> ```
> 
> 
> Thanks,
> 
> Jing Chen
> 
>



Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-10-24 Thread Jing Chen

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

(Updated Oct. 25, 2016, 2:14 a.m.)


Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.


Bugs: AURORA-1504
https://issues.apache.org/jira/browse/AURORA-1504


Repository: aurora


Description
---

aurora job inspect should have a --write-json option


Diffs
-

  src/main/python/apache/aurora/client/cli/jobs.py 
87fbf13f8e5955b30436f8d871b548275f009893 
  src/test/python/apache/aurora/client/cli/test_inspect.py 
fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 

Diff: https://reviews.apache.org/r/53114/diff/


Testing (updated)
---

* For configuration for a job as:
```
pkg_path = '/vagrant/hello.py'

install = Process(
name='fetch package',
cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))

runner = Process(
name='hello jing',
ephemeral = True,
cmdline='python -u hello.py')

hello_task = SequentialTask(
name='hello task',
processes=[install, runner],
resources=Resources(cpu=1, ram=1*MB, disk=8*MB))

jobs = [
Service(cluster='devcluster',
role='www-data',
environment='devel',
name='hello_jing',
task=hello_task,
constraints = {
  'host':'limit:2',
  'rack':'limit:1'
})
]
```
command 'aurora job inspect devcluster/www-data/devel/hello_jing 
/vagrant/hello.aurora --write-json' returns:
```
{
  "job": {
"name": "hello_jing",
"role": "www-data",
"cluster": "devcluster",
"instances": "1",
"constraints": [
  {
"host": "limit:2"
  },
  {
"rack": "limit:1"
  }
],
"service": true,
"production": false
  },
  "task": {
"name": "hello task",
"constraints": [
  "fetch package < hello jing"
],
"processes": [
  {
"name": "fetch package",
"daemon": false,
"ephemeral": false,
"final": false,
"cmdline": [
  "cp /vagrant/hello.py . && chmod u+x hello.py"
]
  },
  {
"name": "hello jing",
"daemon": false,
"ephemeral": true,
"final": false,
"cmdline": [
  "python -u hello.py"
]
  }
]
  }
}

```

* For configuration for a cron job as:
```
jobs = [
  Job(
cluster = 'devcluster',
role = 'www-data',
environment = 'devel',
name = 'cron_hello_jing',
cron_schedule = '*/10 * * * *',
cron_collision_policy='CANCEL_NEW',
task = Task(
  name="cron_hello_jing",
  processes=[Process(name="hello_jing",
   cmdline="echo 'cron hello jing'")],
  resources=Resources(cpu=1, ram=1*MB, disk=8*MB)
)
  )
]
```
command aurora job inspect devcluster/www-data/devel/cron_hello_jing 
/vagrant/cron_hello_world.aurora --write-json returns:
```
{
  "job": {
"name": "cron_hello_jing",
"role": "www-data",
"cluster": "devcluster",
"instances": "1",
"cron": {
  "schedule": "*/10 * * * *",
  "policy": "CANCEL_NEW"
},
"service": false,
"production": false
  },
  "task": {
"name": "cron_hello_jing",
"processes": [
  {
"name": "hello_jing",
"daemon": false,
"ephemeral": false,
"final": false,
"cmdline": [
  "echo 'cron hello jing'"
]
  }
]
  }
}
```


Thanks,

Jing Chen



Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-10-24 Thread Jing Chen

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

(Updated Oct. 25, 2016, 2:06 a.m.)


Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.


Bugs: AURORA-1504
https://issues.apache.org/jira/browse/AURORA-1504


Repository: aurora


Description
---

aurora job inspect should have a --write-json option


Diffs (updated)
-

  src/main/python/apache/aurora/client/cli/jobs.py 
87fbf13f8e5955b30436f8d871b548275f009893 
  src/test/python/apache/aurora/client/cli/test_inspect.py 
fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 

Diff: https://reviews.apache.org/r/53114/diff/


Testing
---

* For configuration for a job as:
```
pkg_path = '/vagrant/hello.py'

install = Process(
name='fetch package',
cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))

runner = Process(
name='hello jing',
ephemeral = True,
cmdline='python -u hello.py')

hello_task = SequentialTask(
name='hello task',
processes=[install, runner],
resources=Resources(cpu=1, ram=1*MB, disk=8*MB))

jobs = [
Service(cluster='devcluster',
role='www-data',
environment='devel',
name='hello_jing',
task=hello_task,
constraints = {
  'host':'limit:2',
  'rack':'limit:1'
})
]
```
command 'aurora job inspect devcluster/www-data/devel/hello_jing 
/vagrant/hello.aurora --write-json' returns:
```
{
  "job": {
"name": "hello_jing",
"role": "www-data",
"contact": "",
"cluster": "devcluster",
"instances": "1",
"constraints": [
  {
"host": "limit:2"
  },
  {
"rack": "limit:1"
  }
],
"service": true,
"production": false
  },
  "task": {
"name": "hello task",
"constraints": [
  "fetch package < hello jing"
],
"processes": [
  {
"name": "fetch package",
"daemon": false,
"ephemeral": false,
"final": false,
"cmdline": [
  "cp /vagrant/hello.py . && chmod u+x hello.py"
]
  },
  {
"name": "hello jing",
"daemon": false,
"ephemeral": true,
"final": false,
"cmdline": [
  "python -u hello.py"
]
  }
]
  }
}

```

* For configuration for a cron job as:
```
jobs = [
  Job(
cluster = 'devcluster',
role = 'www-data',
environment = 'devel',
name = 'cron_hello_jing',
cron_schedule = '*/10 * * * *',
cron_collision_policy='CANCEL_NEW',
task = Task(
  name="cron_hello_jing",
  processes=[Process(name="hello_jing",
   cmdline="echo 'cron hello jing'")],
  resources=Resources(cpu=1, ram=1*MB, disk=8*MB)
)
  )
]
```
command aurora job inspect devcluster/www-data/devel/cron_hello_jing 
/vagrant/cron_hello_world.aurora --write-json returns:
```
{
  "job": {
"name": "cron_hello_jing",
"role": "www-data",
"contact": "",
"cluster": "devcluster",
"instances": "1",
"cron": {
  "schedule": "*/10 * * * *",
  "policy": "CANCEL_NEW"
},
"service": false,
"production": false
  },
  "task": {
"name": "cron_hello_jing",
"processes": [
  {
"name": "hello_jing",
"daemon": false,
"ephemeral": false,
"final": false,
"cmdline": [
  "echo 'cron hello jing'"
]
  }
]
  }
}
```


Thanks,

Jing Chen



Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-10-24 Thread Jing Chen


> On Oct. 24, 2016, 4:04 p.m., Joshua Cohen wrote:
> > Thanks once again for the patch!
> > 
> > If I'm missing something and the changes on the non-json rendering side are 
> > necessary, can you also ensure that the output there is identical 
> > before/after your patch (i.e. run `aurora job inspect` on master and this 
> > branch and diff the output)?
> 
> Jing Chen wrote:
> the only difference for non-json rendering is contraint. I use 2 spaces 
> to indent the containts content. For example,
> 
> beofre:
> ```
> "constraints":
> "fetch package < hello world"
> ```
> now:
> ```
> "constraints":
>   "fetch package < hello world"
> ```
> If the indentation is not necessary for contraints, I could remove it.

The non-json output renders the contact even if no contact given as ``, will fix that on both json and non-json rendering


- Jing


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


On Oct. 23, 2016, 12:37 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Oct. 23, 2016, 12:37 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> * For configuration for a job as:
> ```
> pkg_path = '/vagrant/hello.py'
> 
> install = Process(
> name='fetch package',
> cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))
> 
> runner = Process(
> name='hello jing',
> ephemeral = True,
> cmdline='python -u hello.py')
> 
> hello_task = SequentialTask(
> name='hello task',
> processes=[install, runner],
> resources=Resources(cpu=1, ram=1*MB, disk=8*MB))
> 
> jobs = [
> Service(cluster='devcluster',
> role='www-data',
> environment='devel',
> name='hello_jing',
> task=hello_task,
> constraints = {
>   'host':'limit:2',
>   'rack':'limit:1'
> })
> ]
> ```
> command 'aurora job inspect devcluster/www-data/devel/hello_jing 
> /vagrant/hello.aurora --write-json' returns:
> ```
> {
>   "job": {
> "name": "hello_jing",
> "role": "www-data",
> "contact": "",
> "cluster": "devcluster",
> "instances": "1",
> "constraints": [
>   {
> "host": "limit:2"
>   },
>   {
> "rack": "limit:1"
>   }
> ],
> "service": true,
> "production": false
>   },
>   "task": {
> "name": "hello task",
> "constraints": [
>   "fetch package < hello jing"
> ],
> "processes": [
>   {
> "name": "fetch package",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "cp /vagrant/hello.py . && chmod u+x hello.py"
> ]
>   },
>   {
> "name": "hello jing",
> "daemon": false,
> "ephemeral": true,
> "final": false,
> "cmdline": [
>   "python -u hello.py"
> ]
>   }
> ]
>   }
> }
> 
> ```
> 
> * For configuration for a cron job as:
> ```
> jobs = [
>   Job(
> cluster = 'devcluster',
> role = 'www-data',
> environment = 'devel',
> name = 'cron_hello_jing',
> cron_schedule = '*/10 * * * *',
> cron_collision_policy='CANCEL_NEW',
> task = Task(
>   name="cron_hello_jing",
>   processes=[Process(name="hello_jing",
>cmdline="echo 'cron hello jing'")],
>   resources=Resources(cpu=1, ram=1*MB, disk=8*MB)
> )
>   )
> ]
> ```
> command aurora job inspect devcluster/www-data/devel/cron_hello_jing 
> /vagrant/cron_hello_world.aurora --write-json returns:
> ```
> {
>   "job": {
> "name": "cron_hello_jing",
> "role": "www-data",
> "contact": "",
> "cluster": "devcluster",
> "instances": "1",
> "cron": {
>   "schedule": "*/10 * * * *",
>   "policy": "CANCEL_NEW"
> },
> "service": false,
> "production": false
>   },
>   "task": {
> "name": "cron_hello_jing",
> "processes": [
>   {
> "name": "hello_jing",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "echo 'cron hello jing'"

Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-10-24 Thread Jing Chen


> On Oct. 24, 2016, 4:04 p.m., Joshua Cohen wrote:
> > Thanks once again for the patch!
> > 
> > If I'm missing something and the changes on the non-json rendering side are 
> > necessary, can you also ensure that the output there is identical 
> > before/after your patch (i.e. run `aurora job inspect` on master and this 
> > branch and diff the output)?

the only difference for non-json rendering is contraint. I use 2 spaces to 
indent the containts content. For example,

beofre:
```
"constraints":
"fetch package < hello world"
```
now:
```
"constraints":
  "fetch package < hello world"
```
If the indentation is not necessary for contraints, I could remove it.


> On Oct. 24, 2016, 4:04 p.m., Joshua Cohen wrote:
> > src/main/python/apache/aurora/client/cli/jobs.py, line 238
> > 
> >
> > Was the refactoring here to write to build up an array and then return 
> > the joined string necessary? It seems like this method is not called in the 
> > write json path? Can we just leave this as is and continue to directly use 
> > `context.print_out` to render (which has the slight benefit of handling 
> > indentation if the value is multi-line)?

It is the refactoring here of human readable configuration output, the reason 
for the method is only for readability, when the option is enabled, the output 
will be in json format, otherwise, it prints out as before by 
_reder_config_pretty_. Once we enable --write-json option, I don't think it is 
necessary to print out those information since json output provides the same 
information, so the method won't be called, only json format is printed. 

One more question here is where to put those _context.print_outs_, should I put 
in separated method _render_config_pretty_ or _execute_? Thanks Joshua.


- Jing


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


On Oct. 23, 2016, 12:37 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Oct. 23, 2016, 12:37 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> * For configuration for a job as:
> ```
> pkg_path = '/vagrant/hello.py'
> 
> install = Process(
> name='fetch package',
> cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))
> 
> runner = Process(
> name='hello jing',
> ephemeral = True,
> cmdline='python -u hello.py')
> 
> hello_task = SequentialTask(
> name='hello task',
> processes=[install, runner],
> resources=Resources(cpu=1, ram=1*MB, disk=8*MB))
> 
> jobs = [
> Service(cluster='devcluster',
> role='www-data',
> environment='devel',
> name='hello_jing',
> task=hello_task,
> constraints = {
>   'host':'limit:2',
>   'rack':'limit:1'
> })
> ]
> ```
> command 'aurora job inspect devcluster/www-data/devel/hello_jing 
> /vagrant/hello.aurora --write-json' returns:
> ```
> {
>   "job": {
> "name": "hello_jing",
> "role": "www-data",
> "contact": "",
> "cluster": "devcluster",
> "instances": "1",
> "constraints": [
>   {
> "host": "limit:2"
>   },
>   {
> "rack": "limit:1"
>   }
> ],
> "service": true,
> "production": false
>   },
>   "task": {
> "name": "hello task",
> "constraints": [
>   "fetch package < hello jing"
> ],
> "processes": [
>   {
> "name": "fetch package",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "cp /vagrant/hello.py . && chmod u+x hello.py"
> ]
>   },
>   {
> "name": "hello jing",
> "daemon": false,
> "ephemeral": true,
> "final": false,
> "cmdline": [
>   "python -u hello.py"
> ]
>   }
> ]
>   }
> }
> 
> ```
> 
> * For configuration for a cron job as:
> ```
> jobs = [
>   Job(
> cluster = 'devcluster',
> role = 'www-data',
> environment = 'devel',
> name = 'cron_hello_jing',
> cron_schedule = '*/10 * * * *',
> 

Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-10-24 Thread Joshua Cohen

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



Thanks once again for the patch!

If I'm missing something and the changes on the non-json rendering side are 
necessary, can you also ensure that the output there is identical before/after 
your patch (i.e. run `aurora job inspect` on master and this branch and diff 
the output)?


src/main/python/apache/aurora/client/cli/jobs.py (line 238)


Was the refactoring here to write to build up an array and then return the 
joined string necessary? It seems like this method is not called in the write 
json path? Can we just leave this as is and continue to directly use 
`context.print_out` to render (which has the slight benefit of handling 
indentation if the value is multi-line)?



src/main/python/apache/aurora/client/cli/jobs.py (line 291)


We should fix this so it doesn't render `` if no contact is set.


- Joshua Cohen


On Oct. 23, 2016, 12:37 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Oct. 23, 2016, 12:37 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> * For configuration for a job as:
> ```
> pkg_path = '/vagrant/hello.py'
> 
> install = Process(
> name='fetch package',
> cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))
> 
> runner = Process(
> name='hello jing',
> ephemeral = True,
> cmdline='python -u hello.py')
> 
> hello_task = SequentialTask(
> name='hello task',
> processes=[install, runner],
> resources=Resources(cpu=1, ram=1*MB, disk=8*MB))
> 
> jobs = [
> Service(cluster='devcluster',
> role='www-data',
> environment='devel',
> name='hello_jing',
> task=hello_task,
> constraints = {
>   'host':'limit:2',
>   'rack':'limit:1'
> })
> ]
> ```
> command 'aurora job inspect devcluster/www-data/devel/hello_jing 
> /vagrant/hello.aurora --write-json' returns:
> ```
> {
>   "job": {
> "name": "hello_jing",
> "role": "www-data",
> "contact": "",
> "cluster": "devcluster",
> "instances": "1",
> "constraints": [
>   {
> "host": "limit:2"
>   },
>   {
> "rack": "limit:1"
>   }
> ],
> "service": true,
> "production": false
>   },
>   "task": {
> "name": "hello task",
> "constraints": [
>   "fetch package < hello jing"
> ],
> "processes": [
>   {
> "name": "fetch package",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "cp /vagrant/hello.py . && chmod u+x hello.py"
> ]
>   },
>   {
> "name": "hello jing",
> "daemon": false,
> "ephemeral": true,
> "final": false,
> "cmdline": [
>   "python -u hello.py"
> ]
>   }
> ]
>   }
> }
> 
> ```
> 
> * For configuration for a cron job as:
> ```
> jobs = [
>   Job(
> cluster = 'devcluster',
> role = 'www-data',
> environment = 'devel',
> name = 'cron_hello_jing',
> cron_schedule = '*/10 * * * *',
> cron_collision_policy='CANCEL_NEW',
> task = Task(
>   name="cron_hello_jing",
>   processes=[Process(name="hello_jing",
>cmdline="echo 'cron hello jing'")],
>   resources=Resources(cpu=1, ram=1*MB, disk=8*MB)
> )
>   )
> ]
> ```
> command aurora job inspect devcluster/www-data/devel/cron_hello_jing 
> /vagrant/cron_hello_world.aurora --write-json returns:
> ```
> {
>   "job": {
> "name": "cron_hello_jing",
> "role": "www-data",
> "contact": "",
> "cluster": "devcluster",
> "instances": "1",
> "cron": {
>   "schedule": "*/10 * * * *",
>   "policy": "CANCEL_NEW"
> },
> "service": false,
> "production": false
>   },
>   "task": {
> "name": "cron_hello_jing",
> "processes": [
>   {
> "name": "hello_jing",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": 

Re: Review Request 53114: aurora job inspect should have a --write-json option

2016-10-22 Thread Aurora ReviewBot

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


Ship it!




Master (f4259c4) is green with this patch.
  ./build-support/jenkins/build.sh

I will refresh this build result if you post a review containing "@ReviewBot 
retry"

- Aurora ReviewBot


On Oct. 23, 2016, 12:37 a.m., Jing Chen wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53114/
> ---
> 
> (Updated Oct. 23, 2016, 12:37 a.m.)
> 
> 
> Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.
> 
> 
> Bugs: AURORA-1504
> https://issues.apache.org/jira/browse/AURORA-1504
> 
> 
> Repository: aurora
> 
> 
> Description
> ---
> 
> aurora job inspect should have a --write-json option
> 
> 
> Diffs
> -
> 
>   src/main/python/apache/aurora/client/cli/jobs.py 
> 87fbf13f8e5955b30436f8d871b548275f009893 
>   src/test/python/apache/aurora/client/cli/test_inspect.py 
> fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 
> 
> Diff: https://reviews.apache.org/r/53114/diff/
> 
> 
> Testing
> ---
> 
> * For configuration for a job as:
> ```
> pkg_path = '/vagrant/hello.py'
> 
> install = Process(
> name='fetch package',
> cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))
> 
> runner = Process(
> name='hello jing',
> ephemeral = True,
> cmdline='python -u hello.py')
> 
> hello_task = SequentialTask(
> name='hello task',
> processes=[install, runner],
> resources=Resources(cpu=1, ram=1*MB, disk=8*MB))
> 
> jobs = [
> Service(cluster='devcluster',
> role='www-data',
> environment='devel',
> name='hello_jing',
> task=hello_task,
> constraints = {
>   'host':'limit:2',
>   'rack':'limit:1'
> })
> ]
> ```
> command 'aurora job inspect devcluster/www-data/devel/hello_jing 
> /vagrant/hello.aurora --write-json' returns:
> ```
> {
>   "job": {
> "name": "hello_jing",
> "role": "www-data",
> "contact": "",
> "cluster": "devcluster",
> "instances": "1",
> "constraints": [
>   {
> "host": "limit:2"
>   },
>   {
> "rack": "limit:1"
>   }
> ],
> "service": true,
> "production": false
>   },
>   "task": {
> "name": "hello task",
> "constraints": [
>   "fetch package < hello jing"
> ],
> "processes": [
>   {
> "name": "fetch package",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "cp /vagrant/hello.py . && chmod u+x hello.py"
> ]
>   },
>   {
> "name": "hello jing",
> "daemon": false,
> "ephemeral": true,
> "final": false,
> "cmdline": [
>   "python -u hello.py"
> ]
>   }
> ]
>   }
> }
> 
> ```
> 
> * For configuration for a cron job as:
> ```
> jobs = [
>   Job(
> cluster = 'devcluster',
> role = 'www-data',
> environment = 'devel',
> name = 'cron_hello_jing',
> cron_schedule = '*/10 * * * *',
> cron_collision_policy='CANCEL_NEW',
> task = Task(
>   name="cron_hello_jing",
>   processes=[Process(name="hello_jing",
>cmdline="echo 'cron hello jing'")],
>   resources=Resources(cpu=1, ram=1*MB, disk=8*MB)
> )
>   )
> ]
> ```
> command aurora job inspect devcluster/www-data/devel/cron_hello_jing 
> /vagrant/cron_hello_world.aurora --write-json returns:
> ```
> {
>   "job": {
> "name": "cron_hello_jing",
> "role": "www-data",
> "contact": "",
> "cluster": "devcluster",
> "instances": "1",
> "cron": {
>   "schedule": "*/10 * * * *",
>   "policy": "CANCEL_NEW"
> },
> "service": false,
> "production": false
>   },
>   "task": {
> "name": "cron_hello_jing",
> "processes": [
>   {
> "name": "hello_jing",
> "daemon": false,
> "ephemeral": false,
> "final": false,
> "cmdline": [
>   "echo 'cron hello jing'"
> ]
>   }
> ]
>   }
> }
> ```
> 
> 
> Thanks,
> 
> Jing Chen
> 
>



Review Request 53114: aurora job inspect should have a --write-json option

2016-10-22 Thread Jing Chen

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

Review request for Aurora, Joshua Cohen, Brian Wickman, and Zameer Manji.


Bugs: AURORA-1504
https://issues.apache.org/jira/browse/AURORA-1504


Repository: aurora


Description
---

aurora job inspect should have a --write-json option


Diffs
-

  src/main/python/apache/aurora/client/cli/jobs.py 
87fbf13f8e5955b30436f8d871b548275f009893 
  src/test/python/apache/aurora/client/cli/test_inspect.py 
fedc16b3d4e9fb7d6f5f0dc34ad7a1837e34baea 

Diff: https://reviews.apache.org/r/53114/diff/


Testing
---

* For configuration for a job as:
```
pkg_path = '/vagrant/hello.py'

install = Process(
name='fetch package',
cmdline='cp {} . && chmod u+x hello.py'.format(pkg_path))

runner = Process(
name='hello jing',
ephemeral = True,
cmdline='python -u hello.py')

hello_task = SequentialTask(
name='hello task',
processes=[install, runner],
resources=Resources(cpu=1, ram=1*MB, disk=8*MB))

jobs = [
Service(cluster='devcluster',
role='www-data',
environment='devel',
name='hello_jing',
task=hello_task,
constraints = {
  'host':'limit:2',
  'rack':'limit:1'
})
]
```
command 'aurora job inspect devcluster/www-data/devel/hello_jing 
/vagrant/hello.aurora --write-json' returns:
```
{
  "job": {
"name": "hello_jing",
"role": "www-data",
"contact": "",
"cluster": "devcluster",
"instances": "1",
"constraints": [
  {
"host": "limit:2"
  },
  {
"rack": "limit:1"
  }
],
"service": true,
"production": false
  },
  "task": {
"name": "hello task",
"constraints": [
  "fetch package < hello jing"
],
"processes": [
  {
"name": "fetch package",
"daemon": false,
"ephemeral": false,
"final": false,
"cmdline": [
  "cp /vagrant/hello.py . && chmod u+x hello.py"
]
  },
  {
"name": "hello jing",
"daemon": false,
"ephemeral": true,
"final": false,
"cmdline": [
  "python -u hello.py"
]
  }
]
  }
}

```

* For configuration for a cron job as:
```
jobs = [
  Job(
cluster = 'devcluster',
role = 'www-data',
environment = 'devel',
name = 'cron_hello_jing',
cron_schedule = '*/10 * * * *',
cron_collision_policy='CANCEL_NEW',
task = Task(
  name="cron_hello_jing",
  processes=[Process(name="hello_jing",
   cmdline="echo 'cron hello jing'")],
  resources=Resources(cpu=1, ram=1*MB, disk=8*MB)
)
  )
]
```
command aurora job inspect devcluster/www-data/devel/cron_hello_jing 
/vagrant/cron_hello_world.aurora --write-json returns:
```
{
  "job": {
"name": "cron_hello_jing",
"role": "www-data",
"contact": "",
"cluster": "devcluster",
"instances": "1",
"cron": {
  "schedule": "*/10 * * * *",
  "policy": "CANCEL_NEW"
},
"service": false,
"production": false
  },
  "task": {
"name": "cron_hello_jing",
"processes": [
  {
"name": "hello_jing",
"daemon": false,
"ephemeral": false,
"final": false,
"cmdline": [
  "echo 'cron hello jing'"
]
  }
]
  }
}
```


Thanks,

Jing Chen