[Avocado-devel] NRunner: decide on a "wire-format" for time/dates

Cleber Rosa crosa at redhat.com
Thu Oct 31 17:29:30 UTC 2019


On Tue, Oct 29, 2019 at 09:15:57PM +0100, Amador Pahim wrote:
> 
> About precision (mentioned in the trello card), no matter the format
> you pick, it all starts with an epoch on a float with the maximum
> precision provided by the platform (time.time()). So one cannot get
> more precise than that, afaik.
>

Just curiuous: do you mean that a date before the UNIX epoch (which
can be represented in formats such as ISO-8601) is internally
represented, say in Python, as a float with a negative value?

> About format, I'd expect it to be either an epoch, so I do all the
> conversions myself, or an ISO-8601 in my localtime so I don't do any
> conversions. An ISO-8601 in UTC is something in between: I can read,
> but I have to convert so it makes sense.
> 
> But the best of both worlds would be, IMO: let users decide. Get epoch
> internally with time.time(), then allow users either use it as is or
> to format it from the avocado.conf, using the time.strftime()
> formatters, defaults to ISO-8601:

I agree with this partially, but not in the sense that users (humans)
should decide that, because:

 * It's primarily a wire-level format intended for machines
 * It may make sense to let runners use the cheapest and most
   convenient date format
 * The runners themselves should know their environment and test
   type the best
 * The runners will probably know more of resource constraints

This is better explained in my previous response in this thread).  The
results server could then normalize the results.

> 
> [nrunner]
> # datetime: epoch or asctime (defaults to asctime)
> datetime = asctime
> # datefmt: asctime formatters using strftime (defaults to ISO-8601 format)
> datefmt = '%Y-%m-%d %H:%M:%S'
>

I'm hoping that most runner implementations would be as standalone as
possible, so that they can be deployed easily and possibly
automatically on the environment in which the tests will be executed.
Also, it would be great if it could be possible to clean up the runner
deployment.

On some of my experiments, I simply copy "avocado/core/nrunner.py" to
say, "remote-host:/tmp/runner-$(RANDOM)" and executing
"/tmp/runner-$(RANDOM) task-run ..." is enough.

This would IMO discourage its configuration via configuration files.

- Cleber.

> "epoch" would give users time.time().
> "asctime" would give users time.strftime(datefmt, time.localtime(time.time()))
> 
> wait, that's what the logging module does, isn't it? :)
> 
> My 2 cents.
> 
> >
> > [1] - https://trello.com/c/w4iFhDfM
> >
> > Regards,
> > --
> > Beraldo Leal
> > Senior Software Engineer, Virtualization Team
> > Red Hat
> >
> 




More information about the Avocado-devel mailing list