Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request Task to farm #69

Merged
merged 12 commits into from
Jun 14, 2024
Merged

Request Task to farm #69

merged 12 commits into from
Jun 14, 2024

Conversation

rgaudin
Copy link
Member

@rgaudin rgaudin commented Jun 7, 2024

  • Updated ArchiveConfig to use single language (we'll only alow single-lang ZIMs for now)
  • New zimfarm module for ZF API communication
  • New endpoint /{project_id}/archives/{archive_id}/request to request a ZIM to be created by zimfarm.
    • generates collection.json based on files in project
    • uploads collection.json to S3
    • calls zimfarm to create a dedicated, manual, schedule (passing a webhook url)
    • calls zimfarm to request a task for this schedule
    • calls zimfarm to delete schedule
    • records ZF task_id and status change in DB
  • New email sending capability via Mailgun API
  • DB Archive Model has new completed_on property
  • New endpoint /{project_id}/archives/{archive_id}/hook for the zimfarm to inform about status changes
  • records update in DB
  • sends notification emails with Templates
  • Lots of new configuration points (via environs)
  • Reorganized constants by feature
  • Reorganized some utils functions into utils modules
  • Updated alembic post-write hooks to use ruff instead of former isort

Fixes #10

- Updated ArchiveConfig to use single language (we'll only alow single-lang ZIMs for now)
- New zimfarm module for ZF API communication
- New endpoint /{project_id}/archives/{archive_id}/request to request a ZIM to be created by zimfarm.
  - generates collection.json based on files in project
  - uploads collection.json to S3
  - calls zimfarm to create a dedicated, manual, schedule (passing a webhook url)
  - calls zimfarm to request a task for this schedule
  - calls zimfarm to delete schedule
  - records ZF task_id and status change in DB
- New email sending capability via Mailgun API
- DB Archive Model has new completed_on property
- New endpoint /{project_id}/archives/{archive_id}/hook for the zimfarm to inform about status changes
 - records update in DB
 - sends notification emails with Templates
- Lots of new configuration points (via environs)
- Reorganized constants by feature
- Reorganized some utils functions into utils modules
- Updated alembic post-write hooks to use ruff instead of former isort
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 68.27586% with 138 lines in your changes missing coverage. Please review.

Project coverage is 77.08%. Comparing base (a25cbda) to head (ebb41c8).
Report is 450 commits behind head on main.

Files Patch % Lines
backend/api/routes/archives.py 43.01% 49 Missing and 4 partials ⚠️
backend/api/zimfarm.py 70.34% 36 Missing and 7 partials ⚠️
backend/api/email.py 40.00% 16 Missing and 2 partials ⚠️
backend/api/database/utils.py 30.00% 14 Missing ⚠️
backend/api/database/models.py 82.35% 7 Missing and 2 partials ⚠️
backend/api/constants.py 97.61% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #69       +/-   ##
===========================================
- Coverage   94.81%   77.08%   -17.74%     
===========================================
  Files           9       18        +9     
  Lines         193      912      +719     
  Branches       15      105       +90     
===========================================
+ Hits          183      703      +520     
- Misses          8      187      +179     
- Partials        2       22       +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Instead of having an ArchiveConfig model in code that's serialized/deserialized into a dict to enter DB (stored as JSONB)
We now declare the Archive.config as a proper ArchiveConfig and have the serialization done automatically.
This preserves type hints all the way and allows properties access

ArchiveConfig now moved to model as it's part (sub) of a model.

In addition, ArchiveConfig gets an `is_ready()` method that checks values with scraperlib preventing request of incorrect archive config
- introducing a new AsynClient for proper stacktrace in tests errors (all tests should be converted to use it!)
- better ArchiveConfig fixture
- mock (only success for now) of requests calls in zimfarm
- mock (only success for now) of calls to S3
- added test of empty project list (actually tests that fixture works OK)
@rgaudin rgaudin merged commit 1e23ced into main Jun 14, 2024
3 of 5 checks passed
@rgaudin rgaudin deleted the archives-metadata branch June 14, 2024 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request Task to farm
1 participant