Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support st2 timers list #2977

Merged

Conversation

lakshmi-kannan
Copy link
Contributor

Fixes: #2935

Sample CLI calls

(virtualenv)vagrant@st2dev /m/s/s/st2 ❯❯❯ st2 timer list                                                   STORM-2935/st2_timers_list ✭ ✱ ◼
+--------------------------+------+------------------------+------------------------+------------------------+
| id                       | pack | name                   | type                   | parameters             |
+--------------------------+------+------------------------+------------------------+------------------------+
| 58111229d9d7ed401851a354 | core | 762c3cdc-b712-4164     | core.st2.IntervalTimer | {u'unit': u'seconds',  |
|                          |      | -847b-ae94ab9c2a3a     |                        | u'delta': 5}           |
+--------------------------+------+------------------------+------------------------+------------------------+

(virtualenv)vagrant@st2dev /m/s/s/st2 ❯❯❯ st2 timer list --timer-type=core.st2.IntervalTimer             STORM-2935/st2_timers_list_new ✭ ◼
+--------------------------+------+------------------------+------------------------+------------------------+
| id                       | pack | name                   | type                   | parameters             |
+--------------------------+------+------------------------+------------------------+------------------------+
| 58111229d9d7ed401851a354 | core | 762c3cdc-b712-4164     | core.st2.IntervalTimer | {u'unit': u'seconds',  |
|                          |      | -847b-ae94ab9c2a3a     |                        | u'delta': 5}           |
+--------------------------+------+------------------------+------------------------+------------------------+
(virtualenv)vagrant@st2dev /m/s/s/st2 ❯❯❯

(virtualenv)vagrant@st2dev /m/s/s/st2 ❯❯❯ st2 timer get 58111229d9d7ed401851a354                           STORM-2935/st2_timers_list ✭ ✱ ◼
+------------+--------------------------------------------------------------+
| Property   | Value                                                        |
+------------+--------------------------------------------------------------+
| id         | 58111229d9d7ed401851a354                                     |
| name       | 762c3cdc-b712-4164-847b-ae94ab9c2a3a                         |
| pack       | core                                                         |
| parameters | {                                                            |
|            |     "unit": "seconds",                                       |
|            |     "delta": 5                                               |
|            | }                                                            |
| type       | core.st2.IntervalTimer                                       |
| uid        | trigger:core:762c3cdc-b712-4164-847b-                        |
|            | ae94ab9c2a3a:9284f9e5bfbb479342f5ff56e36b917d                |
+------------+--------------------------------------------------------------+
(virtualenv)vagrant@st2dev /m/s/s/st2 ❯❯❯ st2 timer get core.762c3cdc-b712-4164-847b-ae94ab9c2a3a          STORM-2935/st2_timers_list ✭ ✱ ◼
+------------+--------------------------------------------------------------+
| Property   | Value                                                        |
+------------+--------------------------------------------------------------+
| id         | 58111229d9d7ed401851a354                                     |
| name       | 762c3cdc-b712-4164-847b-ae94ab9c2a3a                         |
| pack       | core                                                         |
| parameters | {                                                            |
|            |     "unit": "seconds",                                       |
|            |     "delta": 5                                               |
|            | }                                                            |
| type       | core.st2.IntervalTimer                                       |
| uid        | trigger:core:762c3cdc-b712-4164-847b-                        |
|            | ae94ab9c2a3a:9284f9e5bfbb479342f5ff56e36b917d                |
+------------+--------------------------------------------------------------+
(virtualenv)vagrant@st2dev /m/s/s/st2 ❯❯❯

Sample API calls

(virtualenv)vagrant@st2dev /m/s/s/st2 ❯❯❯ http http://localhost:9101/v1/timers/                          STORM-2935/st2_timers_list ✭ ✖ ✱ ◼
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Content-Type,Authorization,X-Auth-Token,St2-Api-Key,X-Request-ID
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
Access-Control-Allow-Origin: http://172.168.50.50:3000
Access-Control-Expose-Headers: Content-Type,X-Limit,X-Total-Count,X-Request-ID
Connection: keep-alive
Content-Length: 368
Content-Type: application/json; charset=UTF-8
Date: Thu, 20 Oct 2016 18:59:31 GMT
Server: gunicorn/19.6.0
X-Request-ID: 37ac8dce-4677-417c-951b-3d51791a2d2b

[
    {
        "id": "58090c48d9d7ed55d3a378e6",
        "name": "16be27b9-0927-4848-82c6-2e788f404baa",
        "pack": "core",
        "parameters": {
            "delta": 5,
            "unit": "seconds"
        },
        "type": "core.st2.IntervalTimer",
        "uid": "trigger:core:16be27b9-0927-4848-82c6-2e788f404baa:9284f9e5bfbb479342f5ff56e36b917d"
    }
]

(virtualenv)vagrant@st2dev /m/s/s/st2 ❯❯❯ http http://localhost:9101/v1/timers/58090c48d9d7ed55d3a378e6  STORM-2935/st2_timers_list ✭ ✖ ✱ ◼
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Content-Type,Authorization,X-Auth-Token,St2-Api-Key,X-Request-ID
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
Access-Control-Allow-Origin: http://172.168.50.50:3000
Access-Control-Expose-Headers: Content-Type,X-Limit,X-Total-Count,X-Request-ID
Connection: keep-alive
Content-Length: 320
Content-Type: application/json; charset=UTF-8
Date: Thu, 20 Oct 2016 18:59:34 GMT
Server: gunicorn/19.6.0
X-Request-ID: 87174205-1b9a-4d4b-a9ec-5885282d6bfa

{
    "id": "58090c48d9d7ed55d3a378e6",
    "name": "16be27b9-0927-4848-82c6-2e788f404baa",
    "pack": "core",
    "parameters": {
        "delta": 5,
        "unit": "seconds"
    },
    "type": "core.st2.IntervalTimer",
    "uid": "trigger:core:16be27b9-0927-4848-82c6-2e788f404baa:9284f9e5bfbb479342f5ff56e36b917d"
}

(virtualenv)vagrant@st2dev /m/s/s/st2 ❯❯❯ http http://localhost:9101/v1/timers/core.16be27b9-0927-4848-82c6-2e788f404baa
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Content-Type,Authorization,X-Auth-Token,St2-Api-Key,X-Request-ID
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
Access-Control-Allow-Origin: http://172.168.50.50:3000
Access-Control-Expose-Headers: Content-Type,X-Limit,X-Total-Count,X-Request-ID
Connection: keep-alive
Content-Length: 320
Content-Type: application/json; charset=UTF-8
Date: Thu, 20 Oct 2016 18:59:45 GMT
Server: gunicorn/19.6.0
X-Request-ID: 4db2be7e-1026-466b-95c2-8353996b48ab

{
    "id": "58090c48d9d7ed55d3a378e6",
    "name": "16be27b9-0927-4848-82c6-2e788f404baa",
    "pack": "core",
    "parameters": {
        "delta": 5,
        "unit": "seconds"
    },
    "type": "core.st2.IntervalTimer",
    "uid": "trigger:core:16be27b9-0927-4848-82c6-2e788f404baa:9284f9e5bfbb479342f5ff56e36b917d"
}

(virtualenv)vagrant@st2dev /m/s/s/st2 ❯❯❯

@codecov-io
Copy link

codecov-io commented Oct 27, 2016

Current coverage is 76.42% (diff: 79.28%)

Merging #2977 into master will increase coverage by 0.01%

@@             master      #2977   diff @@
==========================================
  Files           421        424     +3   
  Lines         21344      21455   +111   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          16307      16395    +88   
- Misses         5037       5060    +23   
  Partials          0          0          
Diff Coverage File Path
••••• 50% st2api/st2api/controllers/v1/root.py
••••••• 73% new st2client/st2client/commands/timer.py
••••••• 78% new st2api/st2api/controllers/v1/timers.py
•••••••••• 100% st2client/st2client/shell.py
•••••••••• 100% new st2client/st2client/models/timer.py
•••••••••• 100% st2client/st2client/client.py
•••••••••• 100% st2client/st2client/models/init.py

Powered by Codecov. Last update b88c5aa...72aea63

@codyaray
Copy link
Contributor

Adding the rule names in here would be much more useful. I'd like to get (or search for #2973) a timer by rule name. While waiting on #2961, I wrote a script to help debug the st2rulesengine logs. When you have a lot of cron rules, thinking in cron time is not so useful.

@lakshmi-kannan
Copy link
Contributor Author

@codyaray Adding the rule ref is the next step. And I think this issue will stop there. (I was planning to add the rule ref in another PR). I get the usefulness of filtering by regexes but we also want to filter executions by parameters etc. We think of it as a whole search problem and have some interesting ideas. We will look into that in the near future. Till then, you've to rely on your scripts unfortunately :).

@lakshmi-kannan lakshmi-kannan changed the title WIP: Support st2 timers list Support st2 timers list Oct 31, 2016
@lakshmi-kannan lakshmi-kannan merged commit a2c7053 into StackStorm:master Oct 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants