{"action":"created","issue":{"url":"https://api.github.com/repos/flux-framework/flux-sched/issues/157","repository_url":"https://api.github.com/repos/flux-framework/flux-sched","labels_url":"https://api.github.com/repos/flux-framework/flux-sched/issues/157/labels{/name}","comments_url":"https://api.github.com/repos/flux-framework/flux-sched/issues/157/comments","events_url":"https://api.github.com/repos/flux-framework/flux-sched/issues/157/events","html_url":"https://github.com/flux-framework/flux-sched/issues/157","id":150946242,"number":157,"title":"Best ways to provide consistent resrc in different reader modes","user":{"login":"dongahn","id":862123,"avatar_url":"https://avatars.githubusercontent.com/u/862123?v=3","gravatar_id":"","url":"https://api.github.com/users/dongahn","html_url":"https://github.com/dongahn","followers_url":"https://api.github.com/users/dongahn/followers","following_url":"https://api.github.com/users/dongahn/following{/other_user}","gists_url":"https://api.github.com/users/dongahn/gists{/gist_id}","starred_url":"https://api.github.com/users/dongahn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dongahn/subscriptions","organizations_url":"https://api.github.com/users/dongahn/orgs","repos_url":"https://api.github.com/users/dongahn/repos","events_url":"https://api.github.com/users/dongahn/events{/privacy}","received_events_url":"https://api.github.com/users/dongahn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-04-25T18:33:54Z","updated_at":"2016-04-25T20:54:36Z","closed_at":null,"body":"We agreed to move the discussion into a separate issue ticket to capture the issues in a general sense.\r\n\r\nBelow is the copy and paste of the initial discussion on a specific problem (PR #155), which has led to a problem on match tests between the RDL spec file and hwloc info. In general,  inconsistency in the semantics of `resrc`'s fields under different reader modes can lead to undesirable side effects. One specific case here was, resrc sets the name field to be the base name for the node type in rdl reader mode vs. the hostname in hwloc reader mode. \r\n\r\nThere was also a question as to how RDL can be extended to support various hostname conventions. If we want to generate significant discussions on this subject, I will create another issue ticket. \r\n\r\n@grondo posted:\r\n> One question: You mention that sched \"sets name to hostname\" in hwloc reader mode. RDL itself is not supposed to be node-centric and therefore in Lua-based rdl config code rdl_resource_name() does not differentiate between \"node\" types vs other types, and will return name+id for any resource that has an ID field. (e.g. { name: \"core\", id: 1 } returns rdl_resource_name() == \"core1\")\r\n\r\n> I just wanted to make sure this doesn't further affect sched if it is currently behaving node-centric\r\n\r\n@dongahn posted:\r\n> @grondo: Thank you for the quick response and good question!\r\n\r\n> @lipari should chime in for this question. If I read hwloc reader code correctly in here, the name of resrc is actually set to name+id where id is the logical index of hwloc_object_t type except for the node type. For node, resrc sets it to hostname -- and we had some issues when it didn't do it that way: PR #109.\r\n\r\n> I think it will be good if we go through resrc to make sure it builds its internal fields consistently across different reader modes: rdl and hwloc. To me, it is okay as far as the name always returns the same information regardless of the reader mode. You may have a different opinion though.\r\n\r\n@lipari posted:\r\n> @grondo, the resrc code mirrors the conventions established with RFC 4 as well as the rdl code itself. When generating a resrc_t object from an RDL file, I opted to use the rdl_resource_json() instead of the rdl_resource_name() call. I'd have to check, but if the \"name\" field is getting an id appended, that is where it comes from.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/flux-framework/flux-sched/issues/comments/214518589","html_url":"https://github.com/flux-framework/flux-sched/issues/157#issuecomment-214518589","issue_url":"https://api.github.com/repos/flux-framework/flux-sched/issues/157","id":214518589,"user":{"login":"grondo","id":741970,"avatar_url":"https://avatars.githubusercontent.com/u/741970?v=3","gravatar_id":"","url":"https://api.github.com/users/grondo","html_url":"https://github.com/grondo","followers_url":"https://api.github.com/users/grondo/followers","following_url":"https://api.github.com/users/grondo/following{/other_user}","gists_url":"https://api.github.com/users/grondo/gists{/gist_id}","starred_url":"https://api.github.com/users/grondo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grondo/subscriptions","organizations_url":"https://api.github.com/users/grondo/orgs","repos_url":"https://api.github.com/users/grondo/repos","events_url":"https://api.github.com/users/grondo/events{/privacy}","received_events_url":"https://api.github.com/users/grondo/received_events","type":"User","site_admin":false},"created_at":"2016-04-25T20:54:36Z","updated_at":"2016-04-25T20:54:36Z","body":"I agree the problem is in the ambiguity in RFC 4 with \"name or basename\".\r\n\r\nThe id field will certainly remain necessary (you still need to know the logical/physical id of a resource), but how about the following improvement by differentiating \"name\" and \"basename\"\r\n\r\n * Basename: a base name (prefix) of a resource. By default the resource type name.\r\n * ID: a logical numeric identifier differentiating resources of the same basename (optional)\r\n * Name: By default, the resource basename with the ID appended, if ID is set.\r\n\r\nThe RDL config reader we have now would then be enhanced to return the basename and name explicitly in the json representation of the object.\r\n\r\nAlternately, I also liked @trws idea of allowing a resource attribute that allows \"name\" to be a substitution of the basename and id, or any other arbitrary resource attribute. The default would be `\"${basename}${id}\"`, but this allows a lot more flexibility like `\"${basename}-${id}\"` or `\"${basename}${id?\"-\"}${id}\"` (using some invented substitution that substitues \"-\" if `id` is set.)\r\n\r\n"}}