Skip to content

Commit

Permalink
WIP: Prototype data load basic
Browse files Browse the repository at this point in the history
Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
  • Loading branch information
Kairo de Araujo committed Jan 23, 2023
1 parent 729ce3c commit 8c300b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
34 changes: 20 additions & 14 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,19 @@ class status(Enum):

@app.task(serializer="json", bind=True)
def repository_service_tuf_worker(
self, action: str, payload: Optional[Dict[str, Any]] = None
self,
action: str,
payload: Optional[Dict[str, Any]] = None,
refresh_settings: Optional[bool] = True,
):
"""
Repository Service for TUF Metadata Worker
"""
repository.refresh_settings(worker_settings)
if refresh_settings is True:
repository.refresh_settings(worker_settings)

repository_action = getattr(repository, action)

if payload is None:
result = repository_action()
else:
Expand Down Expand Up @@ -140,18 +146,18 @@ def task_received_notifier(**kwargs):
"acks_late": True,
},
},
"publish_targets": {
"task": "app.repository_service_tuf_worker",
"schedule": schedules.crontab(minute="*/1"),
"kwargs": {
"action": "publish_targets",
},
"options": {
"task_id": "publish_targets",
"queue": "rstuf_internals",
"acks_late": True,
},
},
# "publish_targets": {
# "task": "app.repository_service_tuf_worker",
# "schedule": schedules.crontab(minute="*/10"),
# "kwargs": {
# "action": "publish_targets",
# },
# "options": {
# "task_id": "publish_targets",
# "queue": "rstuf_internals",
# "acks_late": True,
# },
# },
}

repository = MetadataRepository.create_service()
1 change: 1 addition & 0 deletions repository_service_tuf_worker/models/targets/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def read_unpublished_rolenames(db: Session) -> Tuple[bool, str]:
.filter(
models.RSTUFTargets.published == False, # noqa
)
.order_by(models.RSTUFTargets.rolename)
.distinct()
.all()
)
Expand Down

0 comments on commit 8c300b6

Please sign in to comment.