Skip to content

Commit

Permalink
Add a tool script for initiating dandi:files extractors
Browse files Browse the repository at this point in the history
On processed repos
  • Loading branch information
candleindark committed May 2, 2024
1 parent fff5569 commit e11b9ce
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tools/run_dandi_files_extractor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This script initiates Celery tasks to run the `dandi:files` on each processed repo.

from sqlalchemy import select

from datalad_registry import create_app
from datalad_registry.models import RepoUrl, db
from datalad_registry.tasks import extract_ds_meta

flask_app = create_app()

with flask_app.app_context():

# Get the IDs of the processed repo URLs
processed_url_ids = (
db.session.execute(select(RepoUrl.id).filter(RepoUrl.processed)).scalars().all()
)

for url_id in processed_url_ids:
extract_ds_meta.delay(url_id, "dandi:files")

0 comments on commit e11b9ce

Please sign in to comment.