Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include some examples of --select. #37

Closed
tomprince opened this issue Oct 20, 2015 · 2 comments · Fixed by #91
Closed

Include some examples of --select. #37

tomprince opened this issue Oct 20, 2015 · 2 comments · Fixed by #91

Comments

@tomprince
Copy link
Contributor

It isn't clear how to write useful queries for `--select``, just from looking at the linked documentation.

@jonathanj
Copy link
Owner

@tomprince Can you give an example of something you were trying to use --select to achieve? I could include some examples of how I've used it but I have no idea if it is useful to anyone else, a better idea of what others are trying to find would help.

@exarkun
Copy link

exarkun commented Oct 29, 2015

I wanted to select a date range using select. With idnar's help I got as far as this:

eliot-tree --select "timestamp > date(\`$(date --date '2015-10-29 12:45:16+0000' +%s)\`)" --select "timestamp < \`$(date --date '2015-10-29 12:47:16+0000' +%s)\`"

The need to use another tool to convert from the formatted timestamps I'm starting with is a bit annoying. It would be cool if I could just give them to Eliot as-is and let it sort out that they're timestamps.

The extra backticks required were kind of annoying too, but I guess that's just how jmespath works...

But the real kicker is that this doesn't actually work:

Traceback (most recent call last):
  File "/home/jean-paul/Environments/flocker/bin/eliot-tree", line 11, in <module>
    sys.exit(main())
  File "/home/jean-paul/Environments/flocker/local/lib/python2.7/site-packages/eliottree/_cli.py", line 108, in main
    display_task_tree(args)
  File "/home/jean-paul/Environments/flocker/local/lib/python2.7/site-packages/eliottree/_cli.py", line 58, in display_task_tree
    human_readable=args.human_readable)
  File "/home/jean-paul/Environments/flocker/local/lib/python2.7/site-packages/eliottree/_cli.py", line 46, in build_task_nodes
    return tree.nodes(tree.merge_tasks(tasks, filter_funcs()))
  File "/home/jean-paul/Environments/flocker/local/lib/python2.7/site-packages/eliottree/tree.py", line 176, in merge_tasks
    pending = _merge(tasks)
  File "/home/jean-paul/Environments/flocker/local/lib/python2.7/site-packages/eliottree/tree.py", line 172, in _merge
    if fn(task):
  File "/home/jean-paul/Environments/flocker/local/lib/python2.7/site-packages/eliottree/filter.py", line 10, in _filter
    return bool(expn.search(task))
  File "/home/jean-paul/Environments/flocker/local/lib/python2.7/site-packages/jmespath/parser.py", line 524, in search
    result = interpreter.visit(self.parsed, value)
  File "/home/jean-paul/Environments/flocker/local/lib/python2.7/site-packages/jmespath/visitor.py", line 66, in visit
    return method(node, *args, **kwargs)
  File "/home/jean-paul/Environments/flocker/local/lib/python2.7/site-packages/jmespath/visitor.py", line 115, in visit_comparator
    self.visit(node['children'][1], value)
TypeError: can't compare datetime.datetime to int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants