{"action":"created","comment":{"url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/comments/43306746","id":43306746,"diff_hunk":"@@ -421,7 +448,73 @@ class JesBackend extends Backend with LazyLogging with ProductionJesAuthenticati\n     }\n   }\n \n-  override def handleCallRestarts(restartableWorkflows: Seq[RestartableWorkflow])(implicit ec: ExecutionContext): Future[Any] = Future(\"FIXME\")\n+  /**\n+   * <ul>\n+   *   <li>Any execution in Failed should fail the restart.</li>\n+   *   <li>Any execution in Aborted should fail the restart.</li>\n+   *   <li>Scatters in Starting should fail the restart.</li>\n+   *   <li>Collectors in Running should be set back to NotStarted.</li>\n+   *   <li>Calls in Starting should be rolled back to NotStarted.</li>\n+   *   <li>Calls in Running with no job key should be rolled back to NotStarted.</li>\n+   * </ul>\n+   *\n+   * Calls in Running *with* a job key should be left in Running.  The WorkflowActor is responsible for\n+   * resuming the call actors for these calls.\n+   */\n+  override def prepareForRestart(restartableWorkflow: WorkflowDescriptor)(implicit ec: ExecutionContext): Future[Unit] = {\n+\n+    lazy val tag = s\"Workflow ${restartableWorkflow.id.shortString}:\"\n+\n+    def handleExecutionStatuses(executions: Traversable[Execution]): Future[Unit] = {\n+\n+      val executionsByStatus = executions.groupBy(_.status) map { case (k, v) => ExecutionStatus.withName(k) -> v }\n+      def stringifyExecutions(executions: Traversable[Execution]): String = {\n+        executions.toSeq.sortWith((lt, rt) => lt.callFqn < rt.callFqn || (lt.callFqn == rt.callFqn && lt.index < rt.index)).mkString(\" \")\n+      }\n+\n+      if (executionsByStatus.contains(ExecutionStatus.Failed)) {\n+        val failedExecutions = stringifyExecutions(executionsByStatus.get(ExecutionStatus.Failed).get)\n+        Future.failed(new Throwable(s\"$tag Cannot restart, found executions in Failed status: \" + failedExecutions))\n+      }\n+      else if (executionsByStatus.contains(ExecutionStatus.Aborted)) {\n+        val abortedExecutions = stringifyExecutions(executionsByStatus.get(ExecutionStatus.Aborted).get)\n+        Future.failed(new Throwable(s\"$tag Cannot restart, found executions in Aborted status: \" + abortedExecutions))\n+      }\n+      else {\n+        // Cromwell currently does not persist the types of executions.  Scatters are identified by this magic\n+        // \"$scatter_\" string.\n+        val (scatters, nonScatters) = executions partition { _.callFqn.contains(\"$scatter_\") }","path":"src/main/scala/cromwell/engine/backend/jes/JesBackend.scala","position":185,"original_position":185,"commit_id":"784fe101d8a0c4c460a2b0e4790cfdbcdcf1cd78","original_commit_id":"784fe101d8a0c4c460a2b0e4790cfdbcdcf1cd78","user":{"login":"Horneth","id":2978948,"avatar_url":"https://avatars.githubusercontent.com/u/2978948?v=3","gravatar_id":"","url":"https://api.github.com/users/Horneth","html_url":"https://github.com/Horneth","followers_url":"https://api.github.com/users/Horneth/followers","following_url":"https://api.github.com/users/Horneth/following{/other_user}","gists_url":"https://api.github.com/users/Horneth/gists{/gist_id}","starred_url":"https://api.github.com/users/Horneth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Horneth/subscriptions","organizations_url":"https://api.github.com/users/Horneth/orgs","repos_url":"https://api.github.com/users/Horneth/repos","events_url":"https://api.github.com/users/Horneth/events{/privacy}","received_events_url":"https://api.github.com/users/Horneth/received_events","type":"User","site_admin":false},"body":"Also, I just checked quickly and I may be wrong, but I think that callFqn does not contain the \"$scatter\" part, unless it's been generated by `fullyQualifiedNameWithIndexScopes`, which I don't think it has in the case of `Execution` class","created_at":"2015-10-28T19:38:00Z","updated_at":"2015-10-28T19:38:00Z","html_url":"https://github.com/broadinstitute/cromwell/pull/259#discussion_r43306746","pull_request_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/259","_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/comments/43306746"},"html":{"href":"https://github.com/broadinstitute/cromwell/pull/259#discussion_r43306746"},"pull_request":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/259"}}},"pull_request":{"url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/259","id":48918820,"html_url":"https://github.com/broadinstitute/cromwell/pull/259","diff_url":"https://github.com/broadinstitute/cromwell/pull/259.diff","patch_url":"https://github.com/broadinstitute/cromwell/pull/259.patch","issue_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/259","number":259,"state":"open","locked":false,"title":"DSDEEPB-1557 JES Restart.","user":{"login":"mcovarr","id":10790523,"avatar_url":"https://avatars.githubusercontent.com/u/10790523?v=3","gravatar_id":"","url":"https://api.github.com/users/mcovarr","html_url":"https://github.com/mcovarr","followers_url":"https://api.github.com/users/mcovarr/followers","following_url":"https://api.github.com/users/mcovarr/following{/other_user}","gists_url":"https://api.github.com/users/mcovarr/gists{/gist_id}","starred_url":"https://api.github.com/users/mcovarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcovarr/subscriptions","organizations_url":"https://api.github.com/users/mcovarr/orgs","repos_url":"https://api.github.com/users/mcovarr/repos","events_url":"https://api.github.com/users/mcovarr/events{/privacy}","received_events_url":"https://api.github.com/users/mcovarr/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-27T19:17:46Z","updated_at":"2015-10-28T19:38:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"506b829f82dc61bfdcd4ca2d45754fb9419fce65","assignee":{"login":"Horneth","id":2978948,"avatar_url":"https://avatars.githubusercontent.com/u/2978948?v=3","gravatar_id":"","url":"https://api.github.com/users/Horneth","html_url":"https://github.com/Horneth","followers_url":"https://api.github.com/users/Horneth/followers","following_url":"https://api.github.com/users/Horneth/following{/other_user}","gists_url":"https://api.github.com/users/Horneth/gists{/gist_id}","starred_url":"https://api.github.com/users/Horneth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Horneth/subscriptions","organizations_url":"https://api.github.com/users/Horneth/orgs","repos_url":"https://api.github.com/users/Horneth/repos","events_url":"https://api.github.com/users/Horneth/events{/privacy}","received_events_url":"https://api.github.com/users/Horneth/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/259/commits","review_comments_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/259/comments","review_comment_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/comments{/number}","comments_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/259/comments","statuses_url":"https://api.github.com/repos/broadinstitute/cromwell/statuses/784fe101d8a0c4c460a2b0e4790cfdbcdcf1cd78","head":{"label":"broadinstitute:mlc_jes_restarts","ref":"mlc_jes_restarts","sha":"784fe101d8a0c4c460a2b0e4790cfdbcdcf1cd78","user":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"repo":{"id":34136406,"name":"cromwell","full_name":"broadinstitute/cromwell","owner":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broadinstitute/cromwell","description":"Workflow Execution Engine using WDL","fork":false,"url":"https://api.github.com/repos/broadinstitute/cromwell","forks_url":"https://api.github.com/repos/broadinstitute/cromwell/forks","keys_url":"https://api.github.com/repos/broadinstitute/cromwell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/cromwell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/cromwell/teams","hooks_url":"https://api.github.com/repos/broadinstitute/cromwell/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/cromwell/events","assignees_url":"https://api.github.com/repos/broadinstitute/cromwell/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/cromwell/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/cromwell/tags","blobs_url":"https://api.github.com/repos/broadinstitute/cromwell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/cromwell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/cromwell/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/cromwell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/cromwell/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/cromwell/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/cromwell/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/cromwell/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/cromwell/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/cromwell/subscription","commits_url":"https://api.github.com/repos/broadinstitute/cromwell/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/cromwell/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/cromwell/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/cromwell/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/cromwell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/cromwell/merges","archive_url":"https://api.github.com/repos/broadinstitute/cromwell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/cromwell/downloads","issues_url":"https://api.github.com/repos/broadinstitute/cromwell/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/cromwell/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/cromwell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/cromwell/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/cromwell/releases{/id}","created_at":"2015-04-17T19:39:36Z","updated_at":"2015-10-13T18:11:00Z","pushed_at":"2015-10-28T16:56:25Z","git_url":"git://github.com/broadinstitute/cromwell.git","ssh_url":"git@github.com:broadinstitute/cromwell.git","clone_url":"https://github.com/broadinstitute/cromwell.git","svn_url":"https://github.com/broadinstitute/cromwell","homepage":"","size":7472,"stargazers_count":9,"watchers_count":9,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":9,"default_branch":"develop"}},"base":{"label":"broadinstitute:develop","ref":"develop","sha":"dde9ade2b80a7b898e03588c736506431d8a68d4","user":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"repo":{"id":34136406,"name":"cromwell","full_name":"broadinstitute/cromwell","owner":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broadinstitute/cromwell","description":"Workflow Execution Engine using WDL","fork":false,"url":"https://api.github.com/repos/broadinstitute/cromwell","forks_url":"https://api.github.com/repos/broadinstitute/cromwell/forks","keys_url":"https://api.github.com/repos/broadinstitute/cromwell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/cromwell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/cromwell/teams","hooks_url":"https://api.github.com/repos/broadinstitute/cromwell/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/cromwell/events","assignees_url":"https://api.github.com/repos/broadinstitute/cromwell/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/cromwell/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/cromwell/tags","blobs_url":"https://api.github.com/repos/broadinstitute/cromwell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/cromwell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/cromwell/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/cromwell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/cromwell/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/cromwell/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/cromwell/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/cromwell/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/cromwell/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/cromwell/subscription","commits_url":"https://api.github.com/repos/broadinstitute/cromwell/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/cromwell/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/cromwell/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/cromwell/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/cromwell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/cromwell/merges","archive_url":"https://api.github.com/repos/broadinstitute/cromwell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/cromwell/downloads","issues_url":"https://api.github.com/repos/broadinstitute/cromwell/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/cromwell/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/cromwell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/cromwell/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/cromwell/releases{/id}","created_at":"2015-04-17T19:39:36Z","updated_at":"2015-10-13T18:11:00Z","pushed_at":"2015-10-28T16:56:25Z","git_url":"git://github.com/broadinstitute/cromwell.git","ssh_url":"git@github.com:broadinstitute/cromwell.git","clone_url":"https://github.com/broadinstitute/cromwell.git","svn_url":"https://github.com/broadinstitute/cromwell","homepage":"","size":7472,"stargazers_count":9,"watchers_count":9,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":9,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/259"},"html":{"href":"https://github.com/broadinstitute/cromwell/pull/259"},"issue":{"href":"https://api.github.com/repos/broadinstitute/cromwell/issues/259"},"comments":{"href":"https://api.github.com/repos/broadinstitute/cromwell/issues/259/comments"},"review_comments":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/259/comments"},"review_comment":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/259/commits"},"statuses":{"href":"https://api.github.com/repos/broadinstitute/cromwell/statuses/784fe101d8a0c4c460a2b0e4790cfdbcdcf1cd78"}}}}