[openstack-dev] [all][oslo] Parse ISO8601 (open) time intervals

Doug Hellmann doug at doughellmann.com
Thu Sep 29 16:07:07 UTC 2016


Excerpts from milanisko k's message of 2016-09-29 09:48:40 +0000:
> út 27. 9. 2016 v 18:05 odesílatel Doug Hellmann <doug at doughellmann.com>
> napsal:
> 
> > Excerpts from milanisko k's message of 2016-09-27 12:30:09 +0000:
> > > Hello Stackers!
> > >
> > > The ironic inspector project keeps track of introspection finished_at
> > time
> > > stamps.
> > > We're just discussing how to reasonably query time ranges over the API[1]
> > > to serve matching introspection statuses to the user.
> > > Wikipedia[2] mentions the ISO8601 time interval specification (and there
> > > are open-interval extensions to that).
> > > It would be nice to be able to specify a query like :
> > >      /v1/introspection?finished_at=2016:09:27:14:17/PT1H
> > > to fetch all introspection statuses that finished within 1hour around
> > 14:17
> > > Today,
> > > or to be able to state an open-ended interval:
> > >     /v1/introspection?finished_at=2016:09:27:14:17/
> > > but oslo_utils.timeutils lacks parsing support for ISO8061 time
> > intervals.
> > >
> > > I'd like to ask whether other projects need to parse time intervals
> > and/or
> > > how do they achieve that.
> > >
> > > Thanks!
> > > milan
> > >
> > > [1]
> > >
> > https://review.openstack.org/#/c/375045/3/specs/list-introspection-statuses.rst
> > > [2] https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
> >
> > You may want to have a look at the dateutil library.
> > https://dateutil.readthedocs.io/en/stable/
> >
> > Doug, I'm afraid that dateutil.parser.parse doesn't support intervals
> either: http://paste.openstack.org/show/583452/
> Is there any interest in oslo_utils.timeutils parsing ISO8601 time
> intervals as in [2]?
> What do OS projects use instead especially w/r http api queries?

Have you talked with the dateutils maintainers about adding support
there?  It would still be better to contribute to dateutil than to
put the function in a library not meant for anyone else outside of
OpenStack to use.

Doug



More information about the OpenStack-dev mailing list