aurora-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jing Chen <milantr...@gmail.com>
Subject Review Request 53114: aurora job inspect should have a --write-json option
Date Sun, 23 Oct 2016 00:37:57 GMT

-----------------------------------------------------------
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": "<class 'pystachio.composite.Empty'>",
    "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": "<class 'pystachio.composite.Empty'>",
    "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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message