def test_strftime_iso8601(self): dt = datetime.datetime(year=2000, month=1, day=1, hour=12, minute=0, second=0) dt = eva.coerce_to_utc(dt) s = eva.strftime_iso8601(dt) self.assertEqual(s, '2000-01-01T12:00:00+0000') dt = 'foo' with self.assertRaises(AttributeError): eva.strftime_iso8601(dt) s = eva.strftime_iso8601(dt, null_string=True) self.assertEqual(s, 'NULL')
def print_datainstance_info(self, datainstance, loglevel=logging.DEBUG): """! @brief Print information about a DataInstance to the debug log. """ self.logger.log(loglevel, 'Product: %s [%s]', datainstance.data.productinstance.product.name, datainstance.data.productinstance.product.slug) self.logger.log(loglevel, 'ProductInstance: %s', datainstance.data.productinstance.id) self.logger.log(loglevel, 'Reference time: %s', eva.strftime_iso8601(datainstance.data.productinstance.reference_time, null_string=True)) self.logger.log(loglevel, 'Time step: from %s to %s', eva.strftime_iso8601(datainstance.data.time_period_begin, null_string=True), eva.strftime_iso8601(datainstance.data.time_period_end, null_string=True)) self.logger.log(loglevel, 'Data format: %s', datainstance.format.name) self.logger.log(loglevel, 'Service backend: %s', datainstance.servicebackend.name)
def set_next_poll_time(self, msecs): """! @brief Specify how long time the Eventloop should wait before polling the status of this job again. """ self.next_poll_time = eva.now_with_timezone() + datetime.timedelta(milliseconds=msecs) self.logger.debug("Next poll for this job: %s", eva.strftime_iso8601(self.next_poll_time))