args, key=value pairs and task yaml

Tim Flink tflink at redhat.com
Tue Feb 4 21:02:42 UTC 2014


As I'm working on the taskotron runner, I've been trying to work
through a good way to declare actions in the task yaml. The current
code allows for one arg and multiple key=value pairs but I don't like
the limitation of just one non-key=value arg and would like to
eliminate them entirely.

I figure that this will be easier to show with an example so I'll use
the following action which would be valid with the current code:

------------------------------------------------------------
Execution:
    python: runtask.py method_name=do_something action=fix
------------------------------------------------------------

The intention of this action is to import a python file called
runtask.py, find and execute a method in that file named "do_something"
and pass in action="fix" to that method, effectively leaving us with a
call similar to:

  do_something(action='fix')

Looking strictly at the yaml, there is a mix of args and key=value
pairs. 'runtask.py' is an arg, the other two are key=value. These are
currently passed into the python directive as a string and a
dictionary, roughly equivalent to:

  command = 'runtask.py'
  input_data = {'method_name':'do_something', 'action':'fix'}
  env_data = get_envdata() # runtime information, like workdir
  process(command, input_data, env_data)


What I'm looking to decide is whether we really need args in addition to
of key=value pairs and if the added complexity is worth it.

I propose that we alter the format to use only key=value pairs which
would be parsed into a dict in the runner. Using the same example as
above, the new action would look something like:

------------------------------------------------------------
Execution:
    python: pyfile=runtask.py method_name=do_something action=fix
------------------------------------------------------------

This would simplify the parsing code and the data passing logic for
execution since all input data would be in the form of a dictionary
instead of separated out into a list/string and a dictionary.

While I slightly prefer the aesthetics of allowing one or more
keyless args in an action instead of all key=value pairs, I can't think
of a use case where restricting input to key=value pairs would cause
problems.

If we do decide that keyless args are needed, I'd rather support more
than one instead of the current arbitrary restriction of just one arg.

Any other thoughts?

Tim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/qa-devel/attachments/20140204/9024898b/attachment.sig>


More information about the qa-devel mailing list