{"action":"created","issue":{"url":"https://api.github.com/repos/ganga-devs/ganga/issues/551","repository_url":"https://api.github.com/repos/ganga-devs/ganga","labels_url":"https://api.github.com/repos/ganga-devs/ganga/issues/551/labels{/name}","comments_url":"https://api.github.com/repos/ganga-devs/ganga/issues/551/comments","events_url":"https://api.github.com/repos/ganga-devs/ganga/issues/551/events","html_url":"https://github.com/ganga-devs/ganga/pull/551","id":158325098,"number":551,"title":"Cleanup DIRAC env caching","user":{"login":"milliams","id":61316,"avatar_url":"https://avatars.githubusercontent.com/u/61316?v=3","gravatar_id":"","url":"https://api.github.com/users/milliams","html_url":"https://github.com/milliams","followers_url":"https://api.github.com/users/milliams/followers","following_url":"https://api.github.com/users/milliams/following{/other_user}","gists_url":"https://api.github.com/users/milliams/gists{/gist_id}","starred_url":"https://api.github.com/users/milliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milliams/subscriptions","organizations_url":"https://api.github.com/users/milliams/orgs","repos_url":"https://api.github.com/users/milliams/repos","events_url":"https://api.github.com/users/milliams/events{/privacy}","received_events_url":"https://api.github.com/users/milliams/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ganga-devs/ganga/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/ganga-devs/ganga/labels/cleanup","name":"cleanup","color":"0052cc"},{"url":"https://api.github.com/repos/ganga-devs/ganga/labels/DIRAC","name":"DIRAC","color":"d4c5f9"},{"url":"https://api.github.com/repos/ganga-devs/ganga/labels/LHCb","name":"LHCb","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"milliams","id":61316,"avatar_url":"https://avatars.githubusercontent.com/u/61316?v=3","gravatar_id":"","url":"https://api.github.com/users/milliams","html_url":"https://github.com/milliams","followers_url":"https://api.github.com/users/milliams/followers","following_url":"https://api.github.com/users/milliams/following{/other_user}","gists_url":"https://api.github.com/users/milliams/gists{/gist_id}","starred_url":"https://api.github.com/users/milliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milliams/subscriptions","organizations_url":"https://api.github.com/users/milliams/orgs","repos_url":"https://api.github.com/users/milliams/repos","events_url":"https://api.github.com/users/milliams/events{/privacy}","received_events_url":"https://api.github.com/users/milliams/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ganga-devs/ganga/milestones/9","html_url":"https://github.com/ganga-devs/ganga/milestones/6.1.21","labels_url":"https://api.github.com/repos/ganga-devs/ganga/milestones/9/labels","id":1762322,"number":9,"title":"6.1.21","description":null,"creator":{"login":"rob-c","id":1102021,"avatar_url":"https://avatars.githubusercontent.com/u/1102021?v=3","gravatar_id":"","url":"https://api.github.com/users/rob-c","html_url":"https://github.com/rob-c","followers_url":"https://api.github.com/users/rob-c/followers","following_url":"https://api.github.com/users/rob-c/following{/other_user}","gists_url":"https://api.github.com/users/rob-c/gists{/gist_id}","starred_url":"https://api.github.com/users/rob-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rob-c/subscriptions","organizations_url":"https://api.github.com/users/rob-c/orgs","repos_url":"https://api.github.com/users/rob-c/repos","events_url":"https://api.github.com/users/rob-c/events{/privacy}","received_events_url":"https://api.github.com/users/rob-c/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":39,"state":"open","created_at":"2016-05-12T12:39:16Z","updated_at":"2016-06-03T09:27:00Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-06-03T09:18:26Z","updated_at":"2016-06-03T10:42:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ganga-devs/ganga/pulls/551","html_url":"https://github.com/ganga-devs/ganga/pull/551","diff_url":"https://github.com/ganga-devs/ganga/pull/551.diff","patch_url":"https://github.com/ganga-devs/ganga/pull/551.patch"},"body":"Sourcing the cached environment for LHCb is showing to be slightly fiddly and sometimes fails to load completely. Different shells and environments can cause it to source the env file badly.\r\n\r\nThis PR allows to cache the DIRAC environment in a JSON file which is safely readable and avoids the problems of exported bash functions entirely.\r\n\r\nThis avoids the repeated use of bash for:\r\n\r\n1. source a command in a bash session\r\n2. `printenv` it to a file\r\n3. source it again in a bash session\r\n4. use it\r\n\r\nand replaces it with:\r\n\r\n1. source a command in a bash session\r\n2. save it to a JSON file\r\n3. read the JSON file\r\n4. use it.\r\n\r\nOther plugins can do the same but only LHCb are slow enough to need it. The environment is still cached per-session in memory. The code to do the caching is moved to the DIRAC plugin.\r\n\r\nDeprecate the `DiracEnvFile` option and replace it with a `DiracEnvSource` option which should point to a sourceable script to provide the environment.\r\n\r\n`DiracEnvJSON` can point to a specific cached env to override the source command."},"comment":{"url":"https://api.github.com/repos/ganga-devs/ganga/issues/comments/223547909","html_url":"https://github.com/ganga-devs/ganga/pull/551#issuecomment-223547909","issue_url":"https://api.github.com/repos/ganga-devs/ganga/issues/551","id":223547909,"user":{"login":"milliams","id":61316,"avatar_url":"https://avatars.githubusercontent.com/u/61316?v=3","gravatar_id":"","url":"https://api.github.com/users/milliams","html_url":"https://github.com/milliams","followers_url":"https://api.github.com/users/milliams/followers","following_url":"https://api.github.com/users/milliams/following{/other_user}","gists_url":"https://api.github.com/users/milliams/gists{/gist_id}","starred_url":"https://api.github.com/users/milliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milliams/subscriptions","organizations_url":"https://api.github.com/users/milliams/orgs","repos_url":"https://api.github.com/users/milliams/repos","events_url":"https://api.github.com/users/milliams/events{/privacy}","received_events_url":"https://api.github.com/users/milliams/received_events","type":"User","site_admin":false},"created_at":"2016-06-03T10:42:10Z","updated_at":"2016-06-03T10:42:10Z","body":"To clarify:\r\n\r\nVanilla DIRAC still does not use any sort of on-disk cache. It runs the `bashrc` at startup and stores the environment in the in-memory `DIRAC_ENV` variable. This has not changed in this PR.\r\n\r\nLHCb DIRAC has changed to store the environment in a JSON file rather than a dump from `printenv`. Conceptually, this is the only change. As before, this file is keyed on the version of LHCbDIRAC used so will update when the version changes.\r\n\r\nThe other changes in this PR are to break out some common code into reusable functions to reduce repetition between vanilla and LHCb."}}
{"actor":{"display_login":"milliams"}}