Skip to content

Commit

Permalink
Merge pull request #526 from griffithlab/civicpy
Browse files Browse the repository at this point in the history
Add job to create the civicpy pkl file
  • Loading branch information
acoffman committed Sep 4, 2019
2 parents 5d60ee0 + 1854289 commit 9fc70a8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/jobs/create_civicpy_cache_pkl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class CreateCivicpyCachePkl < ActiveJob::Base
def perform
system("CIVICPY_CACHE_FILE=#{civicpy_cache_file_location} python3 #{script_path}")
self.class.set(wait_until: Date.tomorrow.midnight).perform_later
end

def script_path
File.join(Rails.root, 'misc_scripts', 'create_civicpy_cache_pkl.py')
end

private
def civicpy_cache_file_location
File.join(Rails.root, 'public', 'downloads', 'civicpy_cache.pkl')
end
end
1 change: 1 addition & 0 deletions lib/capistrano/tasks/dependencies.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace :dependencies do
on roles(:all) do
execute "sudo apt-get -y install python python3-pip"
execute :pip3, "install ndexutil -r #{current_path}/misc_scripts/ndex_requirements.txt --no-cache-dir --no-deps"
execute :pip3, "install civicpy"
end
end
end
3 changes: 3 additions & 0 deletions misc_scripts/create_civicpy_cache_pkl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from civicpy import civic

civic.update_cache()

0 comments on commit 9fc70a8

Please sign in to comment.