distro-tools/apollo/rpmworker/__main__.py

54 lines
1.2 KiB
Python
Raw Permalink Normal View History

2023-02-01 21:37:16 +00:00
"""
Apollo RPM Temporal Worker
This worker only executes tasks that are related to RPMs.
"""
import asyncio
from temporalio.worker import Worker
import click
from apollo.rpmworker.rh_matcher_workflows import RhMatcherWorkflow, RhDefunctWorkflow
from apollo.rpmworker.rh_matcher_activities import get_supported_products_with_rh_mirrors, match_rh_repos, block_remaining_rh_advisories
from apollo.rpmworker.temporal import TASK_QUEUE
from common.database import Database
from common.info import Info
from common.temporal import Temporal
from common.logger import Logger
2023-02-01 21:37:16 +00:00
async def run():
db = Database(True)
await db.init(["apollo.db"])
temporal = Temporal(True)
await temporal.connect()
worker = Worker(
temporal.client,
task_queue=TASK_QUEUE,
workflows=[
RhMatcherWorkflow,
RhDefunctWorkflow,
],
activities=[
get_supported_products_with_rh_mirrors,
match_rh_repos,
block_remaining_rh_advisories,
]
)
await worker.run()
@click.command()
def main():
Info("apollorpmworker", "apollo2")
Logger().info("Starting apollo-rpmworker")
2023-02-01 21:37:16 +00:00
asyncio.run(run())
if __name__ == "__main__":
main()