Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/journal_client.py
# Copyright (C) 2022 The Software Heritage developers | # Copyright (C) 2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import datetime | import datetime | ||||
try: | try: | ||||
from systemd.daemon import notify | from systemd.daemon import notify | ||||
except ImportError: | except ImportError: | ||||
notify = None | notify = None | ||||
import sentry_sdk | import sentry_sdk | ||||
from swh.model.model import TimestampWithTimezone | from swh.model.model import TimestampWithTimezone | ||||
from swh.provenance.algos.origin import origin_add | |||||
from swh.provenance.algos.revision import revision_add | |||||
from swh.provenance.archive import ArchiveInterface | from swh.provenance.archive import ArchiveInterface | ||||
from swh.provenance.interface import ProvenanceInterface | from swh.provenance.interface import ProvenanceInterface | ||||
from swh.provenance.model import OriginEntry, RevisionEntry | from swh.provenance.model import OriginEntry, RevisionEntry | ||||
from swh.provenance.origin import origin_add | |||||
from swh.provenance.revision import revision_add | |||||
EPOCH = datetime.datetime(1970, 1, 1, tzinfo=datetime.timezone.utc) | EPOCH = datetime.datetime(1970, 1, 1, tzinfo=datetime.timezone.utc) | ||||
def process_journal_origins( | def process_journal_origins( | ||||
messages, *, provenance: ProvenanceInterface, archive: ArchiveInterface, **cfg | messages, *, provenance: ProvenanceInterface, archive: ArchiveInterface, **cfg | ||||
) -> None: | ) -> None: | ||||
"""Worker function for `JournalClient.process(worker_fn)`.""" | """Worker function for `JournalClient.process(worker_fn)`.""" | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |