self = <swh.scheduler.tests.test_scheduler.TestScheduler object at 0x7fd39428ba90>
swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7fd39428bba8>
listed_origins = [ListedOrigin(lister_id=UUID('ada5d368-726d-4418-a7b7-c63116b859e6'), url='https://git.example.com/0000', visit_type='....datetime(2020, 6, 15, 16, 0, 0, 5, tzinfo=datetime.timezone.utc), enabled=True, first_seen=None, last_seen=None), ...]
def test_metrics_origins_with_pending_changes(self, swh_scheduler, listed_origins):
swh_scheduler.record_listed_origins(listed_origins)
# Pretend that we've recorded a visit on one origin, in the past with
# respect to the "last update" time for the origin
visited_origin = listed_origins[0]
assert visited_origin.last_update is not None
swh_scheduler.origin_visit_stats_upsert(
[
OriginVisitStats(
url=visited_origin.url,
visit_type=visited_origin.visit_type,
last_eventful=visited_origin.last_update
- datetime.timedelta(days=1),
last_uneventful=None,
last_failed=None,
last_notfound=None,
last_snapshot=hash_to_bytes(
"d81cc0710eb6cf9efd5b920a8453e1e07157b6cd"
),
),
]
)
> ret = swh_scheduler.update_metrics(lister_id=visited_origin.lister_id)
.tox/py3/lib/python3.7/site-packages/swh/scheduler/tests/test_scheduler.py:1282:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/core/db/common.py:62: in _meth
return meth(self, *args, db=db, cur=cur, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/scheduler/backend.py:1016: in update_metrics
cur.execute(query, (lister_id, timestamp))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cursor object at 0x7fd39d122648; closed: -1>
query = 'SELECT last_update, lister_id, origins_enabled, origins_known, origins_never_visited, origins_with_pending_changes, visit_type FROM update_metrics(%s, %s)'
vars = (UUID('ada5d368-726d-4418-a7b7-c63116b859e6'), None)
def execute(self, query, vars=None):
self.column_mapping = []
self._query_executed = True
> return super().execute(query, vars)
E psycopg2.errors.UndefinedFunction: function update_metrics(uuid, unknown) does not exist
E LINE 1: ...ed, origins_with_pending_changes, visit_type FROM update_met...
E ^
E HINT: No function matches the given name and argument types. You might need to add explicit type casts.
.tox/py3/lib/python3.7/site-packages/psycopg2/extras.py:236: UndefinedFunction
TEST RESULT
TEST RESULT
- Run At
- Jun 23 2021, 6:13 PM