{"action":"created","comment":{"url":"https://api.github.com/repos/spotify/styx/pulls/comments/219024851","pull_request_review_id":157095641,"id":219024851,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTAyNDg1MQ==","diff_hunk":"@@ -174,6 +175,36 @@ public static Instant nextInstant(Instant instant, Schedule schedule) {\n     return instants;\n   }\n \n+  /**\n+   * Gets the instant with the offset to the reference instant.\n+   *\n+   * @param referenceInstant The start instant from where to go back or forward\n+   * @param offset           How far to go back or forward\n+   * @param schedule         The schedule of the workflow\n+   *\n+   * @return The instant with the offset to the reference instant\n+   */\n+  public static Instant instantWithOffsetTo(Instant referenceInstant, int offset, Schedule schedule) {\n+    if (!isAligned(referenceInstant, schedule)) {\n+      throw new IllegalArgumentException(\"unaligned reference instant\");\n+    }\n+\n+    final ExecutionTime executionTime = ExecutionTime.forCron(cron(schedule));\n+\n+    Instant currentInstant = referenceInstant;\n+    for (int i = 0; i < Math.abs(offset); i++) {","path":"styx-common/src/main/java/com/spotify/styx/util/TimeUtil.java","position":29,"original_position":29,"commit_id":"16889f9f87d1eecf44063e2e74f6ddca17d2d39a","original_commit_id":"16889f9f87d1eecf44063e2e74f6ddca17d2d39a","user":{"login":"danielnorberg","id":393289,"node_id":"MDQ6VXNlcjM5MzI4OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/393289?v=4","gravatar_id":"","url":"https://api.github.com/users/danielnorberg","html_url":"https://github.com/danielnorberg","followers_url":"https://api.github.com/users/danielnorberg/followers","following_url":"https://api.github.com/users/danielnorberg/following{/other_user}","gists_url":"https://api.github.com/users/danielnorberg/gists{/gist_id}","starred_url":"https://api.github.com/users/danielnorberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielnorberg/subscriptions","organizations_url":"https://api.github.com/users/danielnorberg/orgs","repos_url":"https://api.github.com/users/danielnorberg/repos","events_url":"https://api.github.com/users/danielnorberg/events{/privacy}","received_events_url":"https://api.github.com/users/danielnorberg/received_events","type":"User","site_admin":false},"body":"Offsetting the instant can be done more efficiently: https://github.com/spotify/styx/pull/591/files#diff-83fdfa5c37381e562bd0705651c031a6R271","created_at":"2018-09-20T03:27:47Z","updated_at":"2018-09-20T03:27:47Z","html_url":"https://github.com/spotify/styx/pull/592#discussion_r219024851","pull_request_url":"https://api.github.com/repos/spotify/styx/pulls/592","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/spotify/styx/pulls/comments/219024851"},"html":{"href":"https://github.com/spotify/styx/pull/592#discussion_r219024851"},"pull_request":{"href":"https://api.github.com/repos/spotify/styx/pulls/592"}}},"pull_request":{"url":"https://api.github.com/repos/spotify/styx/pulls/592","id":216754393,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2NzU0Mzkz","html_url":"https://github.com/spotify/styx/pull/592","diff_url":"https://github.com/spotify/styx/pull/592.diff","patch_url":"https://github.com/spotify/styx/pull/592.patch","issue_url":"https://api.github.com/repos/spotify/styx/issues/592","number":592,"state":"open","locked":false,"title":"api: add instances?tail=true to get latest WFIs (alternative to #591)","user":{"login":"honnix","id":158892,"node_id":"MDQ6VXNlcjE1ODg5Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/158892?v=4","gravatar_id":"","url":"https://api.github.com/users/honnix","html_url":"https://github.com/honnix","followers_url":"https://api.github.com/users/honnix/followers","following_url":"https://api.github.com/users/honnix/following{/other_user}","gists_url":"https://api.github.com/users/honnix/gists{/gist_id}","starred_url":"https://api.github.com/users/honnix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/honnix/subscriptions","organizations_url":"https://api.github.com/users/honnix/orgs","repos_url":"https://api.github.com/users/honnix/repos","events_url":"https://api.github.com/users/honnix/events{/privacy}","received_events_url":"https://api.github.com/users/honnix/received_events","type":"User","site_admin":false},"body":"# Hey, I just made a Pull Request!\r\n\r\n## Description\r\n<!--- Describe your changes -->\r\nAllow fetching the latest (by parameter) instances of a workflow.\r\n\r\nAlternative to #591.\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\nUsers want an easy way to to get the latest instances of a workflow for health checking purposes.\r\n\r\n## Have you tested this? If so, how?\r\n<!--- Valid responses are \"I have included unit tests.\" or --> \r\n<!--- \"I ran my jobs with this code and it works for me.\" -->\r\n\r\n## Checklist for PR author(s)\r\n<!--- Put an `x` in all the boxes that apply: -->\r\n- [x] Changes are covered by unit test\r\n- [ ] All tests pass\r\n- [ ] Code coverage check passes\r\n- [ ] Error handling is tested\r\n- [ ] Errors are handled at the appropriate layer\r\n- [ ] Errors that cannot be handled where they occur are propagated\r\n- [ ] (optional) Changes are covered by system test\r\n- [ ] Relevant documentation updated\r\n- [ ] This PR has NO breaking change to public API\r\n- [ ] This PR has breaking change to public API and it is documented\r\n\r\n## Checklist for PR reviewer(s)\r\n<!--- Put an `x` in all the boxes that apply: -->\r\n- [ ] This PR has been incorporated in release note for the coming version\r\n- [ ] Risky changes introduced by this PR have been all considered\r\n\r\n<!---\r\nfor more information on how to submit valuable contributions,\r\nsee https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution\r\n-->\r\n","created_at":"2018-09-19T19:44:57Z","updated_at":"2018-09-20T03:27:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"70e54be250823eb9f3bd1b2a3d86bdb53c6e4a2b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/spotify/styx/pulls/592/commits","review_comments_url":"https://api.github.com/repos/spotify/styx/pulls/592/comments","review_comment_url":"https://api.github.com/repos/spotify/styx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spotify/styx/issues/592/comments","statuses_url":"https://api.github.com/repos/spotify/styx/statuses/16889f9f87d1eecf44063e2e74f6ddca17d2d39a","head":{"label":"spotify:tail-instances-alt","ref":"tail-instances-alt","sha":"16889f9f87d1eecf44063e2e74f6ddca17d2d39a","user":{"login":"spotify","id":251374,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTM3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/251374?v=4","gravatar_id":"","url":"https://api.github.com/users/spotify","html_url":"https://github.com/spotify","followers_url":"https://api.github.com/users/spotify/followers","following_url":"https://api.github.com/users/spotify/following{/other_user}","gists_url":"https://api.github.com/users/spotify/gists{/gist_id}","starred_url":"https://api.github.com/users/spotify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spotify/subscriptions","organizations_url":"https://api.github.com/users/spotify/orgs","repos_url":"https://api.github.com/users/spotify/repos","events_url":"https://api.github.com/users/spotify/events{/privacy}","received_events_url":"https://api.github.com/users/spotify/received_events","type":"Organization","site_admin":false},"repo":{"id":74431644,"node_id":"MDEwOlJlcG9zaXRvcnk3NDQzMTY0NA==","name":"styx","full_name":"spotify/styx","private":false,"owner":{"login":"spotify","id":251374,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTM3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/251374?v=4","gravatar_id":"","url":"https://api.github.com/users/spotify","html_url":"https://github.com/spotify","followers_url":"https://api.github.com/users/spotify/followers","following_url":"https://api.github.com/users/spotify/following{/other_user}","gists_url":"https://api.github.com/users/spotify/gists{/gist_id}","starred_url":"https://api.github.com/users/spotify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spotify/subscriptions","organizations_url":"https://api.github.com/users/spotify/orgs","repos_url":"https://api.github.com/users/spotify/repos","events_url":"https://api.github.com/users/spotify/events{/privacy}","received_events_url":"https://api.github.com/users/spotify/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/spotify/styx","description":"\"The path to execution\", Styx is a service that schedules batch data processing jobs in Docker containers on Kubernetes.","fork":false,"url":"https://api.github.com/repos/spotify/styx","forks_url":"https://api.github.com/repos/spotify/styx/forks","keys_url":"https://api.github.com/repos/spotify/styx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spotify/styx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spotify/styx/teams","hooks_url":"https://api.github.com/repos/spotify/styx/hooks","issue_events_url":"https://api.github.com/repos/spotify/styx/issues/events{/number}","events_url":"https://api.github.com/repos/spotify/styx/events","assignees_url":"https://api.github.com/repos/spotify/styx/assignees{/user}","branches_url":"https://api.github.com/repos/spotify/styx/branches{/branch}","tags_url":"https://api.github.com/repos/spotify/styx/tags","blobs_url":"https://api.github.com/repos/spotify/styx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spotify/styx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spotify/styx/git/refs{/sha}","trees_url":"https://api.github.com/repos/spotify/styx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spotify/styx/statuses/{sha}","languages_url":"https://api.github.com/repos/spotify/styx/languages","stargazers_url":"https://api.github.com/repos/spotify/styx/stargazers","contributors_url":"https://api.github.com/repos/spotify/styx/contributors","subscribers_url":"https://api.github.com/repos/spotify/styx/subscribers","subscription_url":"https://api.github.com/repos/spotify/styx/subscription","commits_url":"https://api.github.com/repos/spotify/styx/commits{/sha}","git_commits_url":"https://api.github.com/repos/spotify/styx/git/commits{/sha}","comments_url":"https://api.github.com/repos/spotify/styx/comments{/number}","issue_comment_url":"https://api.github.com/repos/spotify/styx/issues/comments{/number}","contents_url":"https://api.github.com/repos/spotify/styx/contents/{+path}","compare_url":"https://api.github.com/repos/spotify/styx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spotify/styx/merges","archive_url":"https://api.github.com/repos/spotify/styx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spotify/styx/downloads","issues_url":"https://api.github.com/repos/spotify/styx/issues{/number}","pulls_url":"https://api.github.com/repos/spotify/styx/pulls{/number}","milestones_url":"https://api.github.com/repos/spotify/styx/milestones{/number}","notifications_url":"https://api.github.com/repos/spotify/styx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spotify/styx/labels{/name}","releases_url":"https://api.github.com/repos/spotify/styx/releases{/id}","deployments_url":"https://api.github.com/repos/spotify/styx/deployments","created_at":"2016-11-22T03:44:55Z","updated_at":"2018-09-17T09:00:31Z","pushed_at":"2018-09-20T03:17:09Z","git_url":"git://github.com/spotify/styx.git","ssh_url":"git@github.com:spotify/styx.git","clone_url":"https://github.com/spotify/styx.git","svn_url":"https://github.com/spotify/styx","homepage":"","size":5971,"stargazers_count":112,"watchers_count":112,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":20,"mirror_url":null,"archived":false,"open_issues_count":21,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":20,"open_issues":21,"watchers":112,"default_branch":"master"}},"base":{"label":"spotify:master","ref":"master","sha":"581debc0336bee07ee80740a6d73f0f8dfe3c678","user":{"login":"spotify","id":251374,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTM3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/251374?v=4","gravatar_id":"","url":"https://api.github.com/users/spotify","html_url":"https://github.com/spotify","followers_url":"https://api.github.com/users/spotify/followers","following_url":"https://api.github.com/users/spotify/following{/other_user}","gists_url":"https://api.github.com/users/spotify/gists{/gist_id}","starred_url":"https://api.github.com/users/spotify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spotify/subscriptions","organizations_url":"https://api.github.com/users/spotify/orgs","repos_url":"https://api.github.com/users/spotify/repos","events_url":"https://api.github.com/users/spotify/events{/privacy}","received_events_url":"https://api.github.com/users/spotify/received_events","type":"Organization","site_admin":false},"repo":{"id":74431644,"node_id":"MDEwOlJlcG9zaXRvcnk3NDQzMTY0NA==","name":"styx","full_name":"spotify/styx","private":false,"owner":{"login":"spotify","id":251374,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTM3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/251374?v=4","gravatar_id":"","url":"https://api.github.com/users/spotify","html_url":"https://github.com/spotify","followers_url":"https://api.github.com/users/spotify/followers","following_url":"https://api.github.com/users/spotify/following{/other_user}","gists_url":"https://api.github.com/users/spotify/gists{/gist_id}","starred_url":"https://api.github.com/users/spotify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spotify/subscriptions","organizations_url":"https://api.github.com/users/spotify/orgs","repos_url":"https://api.github.com/users/spotify/repos","events_url":"https://api.github.com/users/spotify/events{/privacy}","received_events_url":"https://api.github.com/users/spotify/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/spotify/styx","description":"\"The path to execution\", Styx is a service that schedules batch data processing jobs in Docker containers on Kubernetes.","fork":false,"url":"https://api.github.com/repos/spotify/styx","forks_url":"https://api.github.com/repos/spotify/styx/forks","keys_url":"https://api.github.com/repos/spotify/styx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spotify/styx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spotify/styx/teams","hooks_url":"https://api.github.com/repos/spotify/styx/hooks","issue_events_url":"https://api.github.com/repos/spotify/styx/issues/events{/number}","events_url":"https://api.github.com/repos/spotify/styx/events","assignees_url":"https://api.github.com/repos/spotify/styx/assignees{/user}","branches_url":"https://api.github.com/repos/spotify/styx/branches{/branch}","tags_url":"https://api.github.com/repos/spotify/styx/tags","blobs_url":"https://api.github.com/repos/spotify/styx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spotify/styx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spotify/styx/git/refs{/sha}","trees_url":"https://api.github.com/repos/spotify/styx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spotify/styx/statuses/{sha}","languages_url":"https://api.github.com/repos/spotify/styx/languages","stargazers_url":"https://api.github.com/repos/spotify/styx/stargazers","contributors_url":"https://api.github.com/repos/spotify/styx/contributors","subscribers_url":"https://api.github.com/repos/spotify/styx/subscribers","subscription_url":"https://api.github.com/repos/spotify/styx/subscription","commits_url":"https://api.github.com/repos/spotify/styx/commits{/sha}","git_commits_url":"https://api.github.com/repos/spotify/styx/git/commits{/sha}","comments_url":"https://api.github.com/repos/spotify/styx/comments{/number}","issue_comment_url":"https://api.github.com/repos/spotify/styx/issues/comments{/number}","contents_url":"https://api.github.com/repos/spotify/styx/contents/{+path}","compare_url":"https://api.github.com/repos/spotify/styx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spotify/styx/merges","archive_url":"https://api.github.com/repos/spotify/styx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spotify/styx/downloads","issues_url":"https://api.github.com/repos/spotify/styx/issues{/number}","pulls_url":"https://api.github.com/repos/spotify/styx/pulls{/number}","milestones_url":"https://api.github.com/repos/spotify/styx/milestones{/number}","notifications_url":"https://api.github.com/repos/spotify/styx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spotify/styx/labels{/name}","releases_url":"https://api.github.com/repos/spotify/styx/releases{/id}","deployments_url":"https://api.github.com/repos/spotify/styx/deployments","created_at":"2016-11-22T03:44:55Z","updated_at":"2018-09-17T09:00:31Z","pushed_at":"2018-09-20T03:17:09Z","git_url":"git://github.com/spotify/styx.git","ssh_url":"git@github.com:spotify/styx.git","clone_url":"https://github.com/spotify/styx.git","svn_url":"https://github.com/spotify/styx","homepage":"","size":5971,"stargazers_count":112,"watchers_count":112,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":20,"mirror_url":null,"archived":false,"open_issues_count":21,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":20,"open_issues":21,"watchers":112,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spotify/styx/pulls/592"},"html":{"href":"https://github.com/spotify/styx/pull/592"},"issue":{"href":"https://api.github.com/repos/spotify/styx/issues/592"},"comments":{"href":"https://api.github.com/repos/spotify/styx/issues/592/comments"},"review_comments":{"href":"https://api.github.com/repos/spotify/styx/pulls/592/comments"},"review_comment":{"href":"https://api.github.com/repos/spotify/styx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spotify/styx/pulls/592/commits"},"statuses":{"href":"https://api.github.com/repos/spotify/styx/statuses/16889f9f87d1eecf44063e2e74f6ddca17d2d39a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"danielnorberg"}}