harvard-lil / perma

Indelible links
420 stars 71 forks source link

Replace Fabric with Invoke #3275

Closed bensteinberg closed 1 year ago

bensteinberg commented 1 year ago

Since we only use Fabric to run things locally, we can switch to Invoke, removing a few dependencies.

Notable changes for developers who use Invoke tasks include replacing underscores with hyphens: invoke dev.init-db instead of fab dev.init_db -- and boolean arguments are really boolean now: invoke run --debug-toolbar instead of fab run:debug_toolbar=True

When writing new Invoke tasks, the two things to remember are including the context as the first argument, and that arguments are not necessarily strings, as they are in Fabric3 -- see https://docs.pyinvoke.org/en/stable/concepts/invoking-tasks.html#type-casting

See also https://github.com/harvard-lil/h2o/pull/1916 and https://github.com/harvard-lil/perma-payments/pull/165. There's some discussion at the latter about whether and how to change the names of files in which Invoke and Celery look for tasks. The short version is that we are going to let the less-configurable Invoke have tasks.py, or tasks/ in this case, and I've chosen to give Celery celery_tasks.py.

I will need to update the CHECK_IA_PENDING and CHECK_LINKS_WITHOUT_CACHED_PLAYBACK_STATUS cron jobs in salt before deploying this to production.

This might be an opportunity to remove obsolete tasks.

codecov[bot] commented 1 year ago

Codecov Report

Merging #3275 (8c4141b) into develop (ad9299c) will decrease coverage by 5.36%. The diff coverage is 4.25%.

@@             Coverage Diff             @@
##           develop    #3275      +/-   ##
===========================================
- Coverage    79.70%   74.35%   -5.36%     
===========================================
  Files           53       55       +2     
  Lines         6125     6566     +441     
===========================================
  Hits          4882     4882              
- Misses        1243     1684     +441     
Impacted Files Coverage Δ
perma_web/perma/celery_tasks.py 55.35% <ø> (ø)
perma_web/perma/site_scripts.py 25.00% <0.00%> (ø)
perma_web/tasks/__init__.py 0.00% <0.00%> (ø)
perma_web/tasks/dev.py 0.00% <0.00%> (ø)
perma_web/api/views.py 85.16% <100.00%> (ø)
perma_web/perma/celery.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.