{"action":"created","issue":{"url":"https://api.github.com/repos/dmwm/DAS/issues/4251","repository_url":"https://api.github.com/repos/dmwm/DAS","labels_url":"https://api.github.com/repos/dmwm/DAS/issues/4251/labels{/name}","comments_url":"https://api.github.com/repos/dmwm/DAS/issues/4251/comments","events_url":"https://api.github.com/repos/dmwm/DAS/issues/4251/events","html_url":"https://github.com/dmwm/DAS/issues/4251","id":140303002,"number":4251,"title":"Issue in CLI","user":{"login":"PerilousApricot","id":93354,"avatar_url":"https://avatars.githubusercontent.com/u/93354?v=3","gravatar_id":"","url":"https://api.github.com/users/PerilousApricot","html_url":"https://github.com/PerilousApricot","followers_url":"https://api.github.com/users/PerilousApricot/followers","following_url":"https://api.github.com/users/PerilousApricot/following{/other_user}","gists_url":"https://api.github.com/users/PerilousApricot/gists{/gist_id}","starred_url":"https://api.github.com/users/PerilousApricot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PerilousApricot/subscriptions","organizations_url":"https://api.github.com/users/PerilousApricot/orgs","repos_url":"https://api.github.com/users/PerilousApricot/repos","events_url":"https://api.github.com/users/PerilousApricot/events{/privacy}","received_events_url":"https://api.github.com/users/PerilousApricot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-11T22:05:51Z","updated_at":"2016-03-14T17:35:02Z","closed_at":null,"body":"When running the following query with the CLI from the webpage:\r\n\r\n```\r\ndataset dataset=/DY1JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/meloam-melotup_v9_gurrola-DY1JetsToLL_M-50_SkimPat-405381fe00d9112adafce059de4ce799-30972ce93378b607cd5a933e6395837d/USER instance=prod/phys03 | grep dataset.modification_time, dataset.nlumis, dataset.nfiles, dataset.nevents\r\n```\r\n\r\nThe output get mangled up pretty badly:\r\n```\r\n\"2016-02-12 17:41:53\" 1 0 3 2 4 7 6 9\r\n```\r\n\r\nI debugged a bit, and the [following](https://github.com/dmwm/DAS/blob/2b8c1a23a6591a54d6c8cfcb8e90594443ff9c58/src/python/DAS/tools/das_client.py#L475) appears to be at fault (not sure if there's a way to have GH inline quote a code snippet with line numbers)\r\n```python\r\n            elif isinstance(data, list):\r\n                if  unique:\r\n                    data = unique_filter(data)\r\n                for row in data:\r\n                    rows = [r for r in get_value(row, filters, base)]\r\n                    if  isinstance(rows[0], list):\r\n                        out = set()\r\n                        for item in rows:\r\n                            for elem in item:\r\n                                out.add(elem)\r\n                        print(' '.join(out))\r\n                    else:\r\n                        print(' '.join(rows))\r\n```\r\nFor this particular query, rows is\r\n```\r\n[['\"2016-02-12 17:41:53\"', '\"2016-02-12 17:41:53\"'], '327612', '1469', '4724069']\r\n```\r\nso it sees rows[0] is a list and then tries to make a set out of the results instead of printing it out directly.\r\n\r\nI'm not sure of the best solution -- Naively, I'd think datasets.modification_time shouldn't be duplicated in the output rows, which would fix it, but I'm not sure if that's the best place to attack it.\r\n\r\nFWIW, the JSON straight out of get_data is:\r\n```JSON\r\n{u'status': u'ok', u'mongo_query': {u'instance': u'prod/phys03', u'spec': {u'dataset.name': u'/DY1JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/meloam-melotup_v9_gurrola-DY1JetsToLL_M-50_SkimPat-405381fe00d9112adafce059de4ce799-30972ce93378b607cd5a933e6395837d/USER'}, u'filters': {u'grep': [u'dataset.modification_time', u'dataset.nlumis', u'dataset.nfiles', u'dataset.nevents']}, u'fields': [u'dataset']}, u'ctime': 0.079175949096700005, u'nresults': 1, u'timestamp': 1457733820.55, u'incache': True, u'data': [{u'das_id': [u'56e340bbe139183269d23c19', u'56e340bbe139183269d23c17', u'56e340bbe139183269d23c16', u'56e340bbe139183269d23c15', u'56e340bbe139183269d23c1b', u'56e340bbe139183269d23c1a'], u'qhash': u'c5baa57b5e90b4743a455a84a16f4b8b', u'cache_id': [u'56e340bce139183269d23c22', u'56e340bce139183269d23c21', u'56e340bce139183269d23c20', u'56e340bbe139183269d23c1f', u'56e340bbe139183269d23c1e', u'56e340bbe139183269d23c1d'], u'dataset': [{}, {}, {u'nfiles': 1469, u'nevents': 4724069, u'nlumis': 327612}, {}, {u'modification_time': u'2016-02-12 17:41:53'}, {u'modification_time': u'2016-02-12 17:41:53'}], u'das': {u'primary_key': u'dataset.name', u'record': 1, u'condition_keys': [u'dataset.name'], u'ts': 1457733820.244951, u'system': [u'reqmgr2', u'reqmgr2', u'dbs3', u'reqmgr2', u'dbs3', u'dbs3'], u'instance': u'prod/phys03', u'api': [u'outputdataset', u'inputdataset', u'filesummaries', u'configIDs', u'datasets', u'dataset_info'], u'expire': 1457734119, u'services': [{u'reqmgr2': [u'reqmgr2']}, {u'reqmgr2': [u'reqmgr2']}, {u'dbs3': [u'dbs3']}, {u'reqmgr2': [u'reqmgr2']}, {u'dbs3': [u'dbs3']}, {u'dbs3': [u'dbs3']}]}, u'_id': u'56e340bce139183269d23c23'}], u'apilist': [u'das_core', u'outputdataset', u'configIDs', u'inputdataset', u'mcm4dataset2', u'datasets', u'filesummaries', u'dataset_info']}\r\nROW: {u'das_id': [u'56e340bbe139183269d23c19', u'56e340bbe139183269d23c17', u'56e340bbe139183269d23c16', u'56e340bbe139183269d23c15', u'56e340bbe139183269d23c1b', u'56e340bbe139183269d23c1a'], u'qhash': u'c5baa57b5e90b4743a455a84a16f4b8b', u'cache_id': [u'56e340bce139183269d23c22', u'56e340bce139183269d23c21', u'56e340bce139183269d23c20', u'56e340bbe139183269d23c1f', u'56e340bbe139183269d23c1e', u'56e340bbe139183269d23c1d'], u'dataset': [{}, {}, {u'nfiles': 1469, u'nevents': 4724069, u'nlumis': 327612}, {}, {u'modification_time': u'2016-02-12 17:41:53'}, {u'modification_time': u'2016-02-12 17:41:53'}], u'das': {u'primary_key': u'dataset.name', u'record': 1, u'condition_keys': [u'dataset.name'], u'ts': 1457733820.244951, u'system': [u'reqmgr2', u'reqmgr2', u'dbs3', u'reqmgr2', u'dbs3', u'dbs3'], u'instance': u'prod/phys03', u'api': [u'outputdataset', u'inputdataset', u'filesummaries', u'configIDs', u'datasets', u'dataset_info'], u'expire': 1457734119, u'services': [{u'reqmgr2': [u'reqmgr2']}, {u'reqmgr2': [u'reqmgr2']}, {u'dbs3': [u'dbs3']}, {u'reqmgr2': [u'reqmgr2']}, {u'dbs3': [u'dbs3']}, {u'dbs3': [u'dbs3']}]}, u'_id': u'56e340bce139183269d23c23'}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/dmwm/DAS/issues/comments/196426292","html_url":"https://github.com/dmwm/DAS/issues/4251#issuecomment-196426292","issue_url":"https://api.github.com/repos/dmwm/DAS/issues/4251","id":196426292,"user":{"login":"PerilousApricot","id":93354,"avatar_url":"https://avatars.githubusercontent.com/u/93354?v=3","gravatar_id":"","url":"https://api.github.com/users/PerilousApricot","html_url":"https://github.com/PerilousApricot","followers_url":"https://api.github.com/users/PerilousApricot/followers","following_url":"https://api.github.com/users/PerilousApricot/following{/other_user}","gists_url":"https://api.github.com/users/PerilousApricot/gists{/gist_id}","starred_url":"https://api.github.com/users/PerilousApricot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PerilousApricot/subscriptions","organizations_url":"https://api.github.com/users/PerilousApricot/orgs","repos_url":"https://api.github.com/users/PerilousApricot/repos","events_url":"https://api.github.com/users/PerilousApricot/events{/privacy}","received_events_url":"https://api.github.com/users/PerilousApricot/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T17:35:02Z","updated_at":"2016-03-14T17:35:02Z","body":"@vkuznet Thanks! I'll give it a shot in a bit and let you know if it is not working."}}