Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Issue40#83

Open
MadinaB wants to merge 8 commits intomozilla:masterfrom
MadinaB:issue40
Open

Issue40#83
MadinaB wants to merge 8 commits intomozilla:masterfrom
MadinaB:issue40

Conversation

@MadinaB
Copy link
Copy Markdown
Contributor

@MadinaB MadinaB commented Nov 11, 2018

The idea is to force each recipe to rely only on logic to post proceed the data.

Currently, these recipes were updated to fit the needs:

  • backout_rate.py
  • activedata_usage.py
  • config_durations.py

and these queries:

  • backout_rate.query
  • activedata_usage.query
  • config_durations.query

The update lies in rewriting recipe files to hold only logic about which queries to run and how to present output data.
For this reason, each query is now consisting of "query" and "argument_parser" fields. "query" contains information about the query and "argument_parser" is an yaml formatted string of
docopt help message.

The basic idea is that a good help message has all necessary information in it to make a parser. (docopt)


Recipe holds information about all the processing requiring things. In order to allow to treat one list of input differently with recipe argument_parser logic and query argument_parser logic modified_docopt was created. It simply overrides main docopt in last 3 lines:
from:

    if matched and left == []:  # better error message if left?
            return Dict((a.name, a.value) for a in (pattern.flat() + collected))
    raise DocoptExit()

to

    if matched:
        return Dict((a.name, a.value) for a in (pattern.flat() + collected))
    DocoptExit()

This is done because if there are some arguments which can not be parsed (left != []) docopt exits. This update forces docopt to return everything that was matched since one argument list will be used to get data for both recipe and the query.


As well, update provides support for not updated queries and recipes:
If no "argument_parser" field is loaded from query on load_query step, program treats recipe as not updated one.


I just had this idea in my mind and wanted to share it :)

I will be very glad for any discussions and critics

Thanks for always being helpful :)

@MadinaB
Copy link
Copy Markdown
Contributor Author

MadinaB commented Nov 11, 2018

screen shot 2018-11-11 at 9 08 59 pm

screen shot 2018-11-11 at 9 09 09 pm

screen shot 2018-11-11 at 9 09 14 pm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant