{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/kibana/issues/23328","repository_url":"https://api.github.com/repos/elastic/kibana","labels_url":"https://api.github.com/repos/elastic/kibana/issues/23328/labels{/name}","comments_url":"https://api.github.com/repos/elastic/kibana/issues/23328/comments","events_url":"https://api.github.com/repos/elastic/kibana/issues/23328/events","html_url":"https://github.com/elastic/kibana/pull/23328","id":361856416,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2NzIyNTc4","number":23328,"title":"[WIP] Kibana task manager","user":{"login":"chrisdavies","id":833377,"node_id":"MDQ6VXNlcjgzMzM3Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/833377?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisdavies","html_url":"https://github.com/chrisdavies","followers_url":"https://api.github.com/users/chrisdavies/followers","following_url":"https://api.github.com/users/chrisdavies/following{/other_user}","gists_url":"https://api.github.com/users/chrisdavies/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdavies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdavies/subscriptions","organizations_url":"https://api.github.com/users/chrisdavies/orgs","repos_url":"https://api.github.com/users/chrisdavies/repos","events_url":"https://api.github.com/users/chrisdavies/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdavies/received_events","type":"User","site_admin":false},"labels":[{"id":409457688,"node_id":"MDU6TGFiZWw0MDk0NTc2ODg=","url":"https://api.github.com/repos/elastic/kibana/labels/WIP","name":"WIP","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-09-19T17:46:15Z","updated_at":"2018-09-22T02:40:35Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/elastic/kibana/pulls/23328","html_url":"https://github.com/elastic/kibana/pull/23328","diff_url":"https://github.com/elastic/kibana/pull/23328.diff","patch_url":"https://github.com/elastic/kibana/pull/23328.patch"},"body":"This PR adds a general purpose task manager to Kibana, allowing:\r\n\r\n- Single-run and recurring tasks\r\n- Scheduling tasks to run after a specified datetime\r\n- Basic retry logic\r\n- Recovery of stalled tasks / timeouts\r\n- Stateful tasks (tracking task state across multiple runs)\r\n- Ability to adjust performance knobs\r\n- Basic coordination to prevent the same task instance from running on more than one Kibana system at a time\r\n\r\n## Testing\r\n\r\nIn a plugin's uiExports, add a task definition:\r\n\r\n```js\r\ntaskDefinitions: {\r\n  foo: {\r\n    title: 'Foo',\r\n    createTaskRunner(context) {\r\n      return {\r\n        async run() {\r\n          const json = JSON.stringify(context.taskInstance.params);\r\n          console.log(`Running \"foo\" with params: ${json}`);\r\n        },\r\n      };\r\n    },\r\n  },\r\n},\r\n```\r\n\r\nStart kibana in REPL mode:\r\n\r\n`yarn start --repl`\r\n\r\nThen, schedule some tasks in the REPL:\r\n\r\n```js\r\nvar { taskManager } = kbnServer.server;\r\n\r\ntaskManager.schedule({\r\n  taskType: 'foo',\r\n  params: { hello: 'world!' },\r\n});\r\n\r\ntaskManager.schedule({\r\n  taskType: 'foo',\r\n  params: { hello: 'world!' },\r\n  runAt: new Date(Date.now() + 2500),\r\n});\r\n```\r\n\r\nSee the README for more info, and tweak the task definition to test various scenarios."},"comment":{"url":"https://api.github.com/repos/elastic/kibana/issues/comments/423711065","html_url":"https://github.com/elastic/kibana/pull/23328#issuecomment-423711065","issue_url":"https://api.github.com/repos/elastic/kibana/issues/23328","id":423711065,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzcxMTA2NQ==","user":{"login":"elasticmachine","id":15837671,"node_id":"MDQ6VXNlcjE1ODM3Njcx","avatar_url":"https://avatars3.githubusercontent.com/u/15837671?v=4","gravatar_id":"","url":"https://api.github.com/users/elasticmachine","html_url":"https://github.com/elasticmachine","followers_url":"https://api.github.com/users/elasticmachine/followers","following_url":"https://api.github.com/users/elasticmachine/following{/other_user}","gists_url":"https://api.github.com/users/elasticmachine/gists{/gist_id}","starred_url":"https://api.github.com/users/elasticmachine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elasticmachine/subscriptions","organizations_url":"https://api.github.com/users/elasticmachine/orgs","repos_url":"https://api.github.com/users/elasticmachine/repos","events_url":"https://api.github.com/users/elasticmachine/events{/privacy}","received_events_url":"https://api.github.com/users/elasticmachine/received_events","type":"User","site_admin":false},"created_at":"2018-09-22T02:40:35Z","updated_at":"2018-09-22T02:40:35Z","author_association":"NONE","body":"## :broken_heart: Build Failed\n* [continuous-integration/kibana-ci/pull-request](https://kibana-ci.elastic.co/job/elastic-kibana-pull-request/3177/)\n\n"}}
{"actor":{"display_login":"elasticmachine"}}