ComputeNodeMonitorActor.offer_arvados_pair() pairs nodes only if
first_ping_time >= cloud_node_start_time
However, first_ping_time is passed through arvados_timestamp() before
this comparison, which was truncating the subsecond part -- so the
comparison was effectively
floor(first_ping_time) >= cloud_node_start_time
When FPT and CNST differed only in the subsecond part, this comparison
failed, and the nodes could never be paired. This caused sporadic
failures in tests, where the two values are often separated by less
than a second.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>
subsecs = float(subsec_match.group(1))
timestr = timestr[:subsec_match.start()] + 'Z'
return calendar.timegm(time.strptime(timestr + 'UTC',
- ARVADOS_TIMEFMT + '%Z'))
+ ARVADOS_TIMEFMT + '%Z')) + subsecs
def timestamp_fresh(timestamp, fresh_time):
return (time.time() - timestamp) < fresh_time
time_mock.return_value += 200
self.assertEqual(961, timer.next_opening())
self.assertFalse(timer.window_open())
+
+
+class ArvadosTimestamp(unittest.TestCase):
+ def test_arvados_timestamp(self):
+ self.assertEqual(1527710178, cnode.arvados_timestamp('2018-05-30T19:56:18Z'))
+ self.assertEqual(1527710178.999371, cnode.arvados_timestamp('2018-05-30T19:56:18.999371Z'))