{"action":"created","comment":{"url":"https://api.github.com/repos/mesosphere/marathon/pulls/comments/175130204","pull_request_review_id":103661146,"id":175130204,"diff_hunk":"@@ -173,18 +173,139 @@ case class Task(taskId: Task.Id, runSpecVersion: Timestamp, status: Task.Status)\n object Task {\n   private val log = LoggerFactory.getLogger(getClass)\n \n-  case class Id(idString: String) extends Ordered[Id] {\n+  /**\n+    * Base for all task identifiers.\n+    */\n+  trait Id extends Ordered[Id] {\n+    // A stringifed version of the id.\n+    val idString: String\n+\n+    // Quick access to the underlying run spec identifier of the task.\n+    val runSpecId: PathId\n+\n+    // Quick access to the underlying instance identifier of the task.\n+    val instanceId: Instance.Id\n+\n+    val reservationId: String\n+\n+    // The Mesos task id representation of the task.\n     lazy val mesosTaskId: MesosProtos.TaskID = MesosProtos.TaskID.newBuilder().setValue(idString).build()\n-    lazy val runSpecId: PathId = Id.runSpecId(idString)\n-    lazy val instanceId: Instance.Id = Id.instanceId(idString)\n-    lazy val containerName: Option[String] = Id.containerName(idString)\n+\n+    // pre-instance-era executorId=\"marathon-$taskId\" and compatibility reasons we need this calculation.\n+    // Should be removed as soon as no tasks without instance exists (tbd)\n+    def calculateLegacyExecutorId(): String = s\"marathon-$idString\"\n+\n+    override def compare(that: Id): Int = idString.compare(that.idString)\n+\n     /**\n-      * For resident tasks, this will denote the number of launched tasks on a reservation since 1.5\n+      * @return String representation for debugging.\n       */\n-    lazy val attempt: Option[Long] = Id.attempt(idString)\n-\n     override def toString: String = s\"task [$idString]\"\n-    override def compare(that: Id): Int = idString.compare(that.idString)\n+  }\n+\n+  /**\n+    * A task identifier for legacy tasks. This cannot represent a pod instance. These ids won't be created but old Mesos\n+    * tasks might have such an instance thus we have to represent them.\n+    *\n+    * This id can also represent an old reservation for a persistent app, ie an app with resident tasks.\n+    *\n+    * The ids match [[Task.Id.LegacyTaskIdRegex]].\n+    *\n+    * Examples:\n+    *  - \"myGroup_myApp.b6ff5fa5-7714-11e7-a55c-5ecf1c4671f6\"\n+    *  - \"myGroup_myApp.b6ff5fa5-7714-11e7-a55c-5ecf1c4671f6\"\n+    *\n+    * @param runSpecId Identifies the run spec the task was started with.\n+    * @param separator This can be \".\" or \"_\".\n+    * @param uuid A unique identifier of the task.\n+    */\n+  case class LegacyId(val runSpecId: PathId, separator: String, uuid: UUID) extends Id {\n+\n+    // A stringifed version of the id.\n+    override val idString: String = runSpecId.safePath + separator + uuid\n+\n+    override lazy val instanceId: Instance.Id = Instance.Id(runSpecId, Instance.PrefixMarathon, uuid)","path":"src/main/scala/mesosphere/marathon/core/task/Task.scala","position":78,"original_position":78,"commit_id":"ecb1be3d09b767a3fd7e16eab23f5b132dcca80e","original_commit_id":"ecb1be3d09b767a3fd7e16eab23f5b132dcca80e","user":{"login":"ichernetsky","id":96977,"avatar_url":"https://avatars1.githubusercontent.com/u/96977?v=4","gravatar_id":"","url":"https://api.github.com/users/ichernetsky","html_url":"https://github.com/ichernetsky","followers_url":"https://api.github.com/users/ichernetsky/followers","following_url":"https://api.github.com/users/ichernetsky/following{/other_user}","gists_url":"https://api.github.com/users/ichernetsky/gists{/gist_id}","starred_url":"https://api.github.com/users/ichernetsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ichernetsky/subscriptions","organizations_url":"https://api.github.com/users/ichernetsky/orgs","repos_url":"https://api.github.com/users/ichernetsky/repos","events_url":"https://api.github.com/users/ichernetsky/events{/privacy}","received_events_url":"https://api.github.com/users/ichernetsky/received_events","type":"User","site_admin":false},"body":"This instance ID will never have a corresponding instance.","created_at":"2018-03-16T15:39:47Z","updated_at":"2018-03-16T15:55:27Z","html_url":"https://github.com/mesosphere/marathon/pull/6076#discussion_r175130204","pull_request_url":"https://api.github.com/repos/mesosphere/marathon/pulls/6076","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mesosphere/marathon/pulls/comments/175130204"},"html":{"href":"https://github.com/mesosphere/marathon/pull/6076#discussion_r175130204"},"pull_request":{"href":"https://api.github.com/repos/mesosphere/marathon/pulls/6076"}}},"pull_request":{"url":"https://api.github.com/repos/mesosphere/marathon/pulls/6076","id":173980890,"html_url":"https://github.com/mesosphere/marathon/pull/6076","diff_url":"https://github.com/mesosphere/marathon/pull/6076.diff","patch_url":"https://github.com/mesosphere/marathon/pull/6076.patch","issue_url":"https://api.github.com/repos/mesosphere/marathon/issues/6076","number":6076,"state":"open","locked":false,"title":"Make instance and task ids case classes.","user":{"login":"jeschkies","id":2418440,"avatar_url":"https://avatars3.githubusercontent.com/u/2418440?v=4","gravatar_id":"","url":"https://api.github.com/users/jeschkies","html_url":"https://github.com/jeschkies","followers_url":"https://api.github.com/users/jeschkies/followers","following_url":"https://api.github.com/users/jeschkies/following{/other_user}","gists_url":"https://api.github.com/users/jeschkies/gists{/gist_id}","starred_url":"https://api.github.com/users/jeschkies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeschkies/subscriptions","organizations_url":"https://api.github.com/users/jeschkies/orgs","repos_url":"https://api.github.com/users/jeschkies/repos","events_url":"https://api.github.com/users/jeschkies/events{/privacy}","received_events_url":"https://api.github.com/users/jeschkies/received_events","type":"User","site_admin":false},"body":"Summary:\r\nWe have different types of instance and task ids. Yet, all are modeled as strings.\r\nInformation is extracted with regular expressions ad-hoc. This patch introduces\r\ndifferent type for different ids and has one method that transforms strings to ids. \r\n\r\nJIRA issues: tbd\r\n","created_at":"2018-03-09T11:21:28Z","updated_at":"2018-03-16T15:55:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fa4d57b8291cf6cbf03df073ef2b986f37b70a3d","assignee":null,"assignees":[],"requested_reviewers":[{"login":"meichstedt","id":414354,"avatar_url":"https://avatars2.githubusercontent.com/u/414354?v=4","gravatar_id":"","url":"https://api.github.com/users/meichstedt","html_url":"https://github.com/meichstedt","followers_url":"https://api.github.com/users/meichstedt/followers","following_url":"https://api.github.com/users/meichstedt/following{/other_user}","gists_url":"https://api.github.com/users/meichstedt/gists{/gist_id}","starred_url":"https://api.github.com/users/meichstedt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meichstedt/subscriptions","organizations_url":"https://api.github.com/users/meichstedt/orgs","repos_url":"https://api.github.com/users/meichstedt/repos","events_url":"https://api.github.com/users/meichstedt/events{/privacy}","received_events_url":"https://api.github.com/users/meichstedt/received_events","type":"User","site_admin":false},{"login":"zen-dog","id":7558454,"avatar_url":"https://avatars2.githubusercontent.com/u/7558454?v=4","gravatar_id":"","url":"https://api.github.com/users/zen-dog","html_url":"https://github.com/zen-dog","followers_url":"https://api.github.com/users/zen-dog/followers","following_url":"https://api.github.com/users/zen-dog/following{/other_user}","gists_url":"https://api.github.com/users/zen-dog/gists{/gist_id}","starred_url":"https://api.github.com/users/zen-dog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zen-dog/subscriptions","organizations_url":"https://api.github.com/users/zen-dog/orgs","repos_url":"https://api.github.com/users/zen-dog/repos","events_url":"https://api.github.com/users/zen-dog/events{/privacy}","received_events_url":"https://api.github.com/users/zen-dog/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mesosphere/marathon/pulls/6076/commits","review_comments_url":"https://api.github.com/repos/mesosphere/marathon/pulls/6076/comments","review_comment_url":"https://api.github.com/repos/mesosphere/marathon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mesosphere/marathon/issues/6076/comments","statuses_url":"https://api.github.com/repos/mesosphere/marathon/statuses/ecb1be3d09b767a3fd7e16eab23f5b132dcca80e","head":{"label":"mesosphere:karsten/better-ids","ref":"karsten/better-ids","sha":"ecb1be3d09b767a3fd7e16eab23f5b132dcca80e","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars0.githubusercontent.com/u/3458585?v=4","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":10941409,"name":"marathon","full_name":"mesosphere/marathon","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars0.githubusercontent.com/u/3458585?v=4","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/marathon","description":"Deploy and manage containers (including Docker) on top of Apache Mesos at scale.","fork":false,"url":"https://api.github.com/repos/mesosphere/marathon","forks_url":"https://api.github.com/repos/mesosphere/marathon/forks","keys_url":"https://api.github.com/repos/mesosphere/marathon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/marathon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/marathon/teams","hooks_url":"https://api.github.com/repos/mesosphere/marathon/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/marathon/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/marathon/events","assignees_url":"https://api.github.com/repos/mesosphere/marathon/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/marathon/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/marathon/tags","blobs_url":"https://api.github.com/repos/mesosphere/marathon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/marathon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/marathon/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/marathon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/marathon/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/marathon/languages","stargazers_url":"https://api.github.com/repos/mesosphere/marathon/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/marathon/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/marathon/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/marathon/subscription","commits_url":"https://api.github.com/repos/mesosphere/marathon/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/marathon/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/marathon/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/marathon/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/marathon/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/marathon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/marathon/merges","archive_url":"https://api.github.com/repos/mesosphere/marathon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/marathon/downloads","issues_url":"https://api.github.com/repos/mesosphere/marathon/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/marathon/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/marathon/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/marathon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/marathon/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/marathon/releases{/id}","deployments_url":"https://api.github.com/repos/mesosphere/marathon/deployments","created_at":"2013-06-25T14:56:34Z","updated_at":"2018-03-16T12:12:07Z","pushed_at":"2018-03-16T15:39:38Z","git_url":"git://github.com/mesosphere/marathon.git","ssh_url":"git@github.com:mesosphere/marathon.git","clone_url":"https://github.com/mesosphere/marathon.git","svn_url":"https://github.com/mesosphere/marathon","homepage":"https://mesosphere.github.io/marathon/","size":34454,"stargazers_count":3598,"watchers_count":3598,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":830,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":830,"open_issues":20,"watchers":3598,"default_branch":"master"}},"base":{"label":"mesosphere:master","ref":"master","sha":"bb7d2c9de2e04096000503ef76459d63a9de3c29","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars0.githubusercontent.com/u/3458585?v=4","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":10941409,"name":"marathon","full_name":"mesosphere/marathon","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars0.githubusercontent.com/u/3458585?v=4","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/marathon","description":"Deploy and manage containers (including Docker) on top of Apache Mesos at scale.","fork":false,"url":"https://api.github.com/repos/mesosphere/marathon","forks_url":"https://api.github.com/repos/mesosphere/marathon/forks","keys_url":"https://api.github.com/repos/mesosphere/marathon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/marathon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/marathon/teams","hooks_url":"https://api.github.com/repos/mesosphere/marathon/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/marathon/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/marathon/events","assignees_url":"https://api.github.com/repos/mesosphere/marathon/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/marathon/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/marathon/tags","blobs_url":"https://api.github.com/repos/mesosphere/marathon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/marathon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/marathon/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/marathon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/marathon/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/marathon/languages","stargazers_url":"https://api.github.com/repos/mesosphere/marathon/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/marathon/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/marathon/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/marathon/subscription","commits_url":"https://api.github.com/repos/mesosphere/marathon/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/marathon/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/marathon/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/marathon/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/marathon/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/marathon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/marathon/merges","archive_url":"https://api.github.com/repos/mesosphere/marathon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/marathon/downloads","issues_url":"https://api.github.com/repos/mesosphere/marathon/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/marathon/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/marathon/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/marathon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/marathon/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/marathon/releases{/id}","deployments_url":"https://api.github.com/repos/mesosphere/marathon/deployments","created_at":"2013-06-25T14:56:34Z","updated_at":"2018-03-16T12:12:07Z","pushed_at":"2018-03-16T15:39:38Z","git_url":"git://github.com/mesosphere/marathon.git","ssh_url":"git@github.com:mesosphere/marathon.git","clone_url":"https://github.com/mesosphere/marathon.git","svn_url":"https://github.com/mesosphere/marathon","homepage":"https://mesosphere.github.io/marathon/","size":34454,"stargazers_count":3598,"watchers_count":3598,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":830,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":830,"open_issues":20,"watchers":3598,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mesosphere/marathon/pulls/6076"},"html":{"href":"https://github.com/mesosphere/marathon/pull/6076"},"issue":{"href":"https://api.github.com/repos/mesosphere/marathon/issues/6076"},"comments":{"href":"https://api.github.com/repos/mesosphere/marathon/issues/6076/comments"},"review_comments":{"href":"https://api.github.com/repos/mesosphere/marathon/pulls/6076/comments"},"review_comment":{"href":"https://api.github.com/repos/mesosphere/marathon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mesosphere/marathon/pulls/6076/commits"},"statuses":{"href":"https://api.github.com/repos/mesosphere/marathon/statuses/ecb1be3d09b767a3fd7e16eab23f5b132dcca80e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ichernetsky"}}