Skip to content

Commit

Permalink
Merge pull request #28205 from dimagi/fr/remove-soil-demo
Browse files Browse the repository at this point in the history
Remove unused soil demo view
  • Loading branch information
proteusvacuum authored Jul 27, 2020
2 parents 51f8145 + 4fe1892 commit 49753fd
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 27 deletions.
17 changes: 1 addition & 16 deletions corehq/ex-submodules/soil/tasks.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
from celery.task import task, periodic_task
import time
from django.core.cache import cache
from soil import CachedDownload
import uuid
from celery.schedules import crontab
from soil.heartbeat import write_file_heartbeat, write_cache_heartbeat
from soil.util import expose_cached_download
from django.conf import settings


@task(serializer='pickle')
def demo_sleep(download_id, howlong=5, expiry=1*60*60):
"""
Demo the downloader, with sleep
"""
time.sleep(howlong)
temp_id = uuid.uuid4().hex
cache.set(temp_id, "It works!", expiry)
cache.set(download_id, CachedDownload(temp_id), expiry)


@task(serializer='pickle')
def prepare_download(download_id, payload_func, content_disposition,
content_type, expiry=10*60*60):
Expand All @@ -41,7 +26,7 @@ def prepare_download(download_id, payload_func, content_disposition,
def heartbeat():
"""
A heartbeat, used to confirm that celery is alive and kicking.
This heartbeat will stop if either celery or celeryd go down.
"""
write_file_heartbeat()
Expand Down
2 changes: 0 additions & 2 deletions corehq/ex-submodules/soil/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

from soil.views import (
ajax_job_poll,
demo,
heartbeat_status,
retrieve_download,
)

urlpatterns = [
url(r'^(?P<download_id>(?:dl-)?[0-9a-fA-Z]{25,32})$', retrieve_download, name='retrieve_download'),
url(r'^ajax/(?P<download_id>(?:dl-)?[0-9a-fA-Z]{25,32})$', ajax_job_poll, name='ajax_job_poll'),
url(r'^demo/$', demo, name='soil_demo'),
url(r'^heartbeat/$', heartbeat_status, name='soil_heartbeat'),
]
9 changes: 0 additions & 9 deletions corehq/ex-submodules/soil/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from soil import DownloadBase
from soil.exceptions import TaskFailedError
from soil.heartbeat import get_file_heartbeat, get_cache_heartbeat, last_heartbeat
from soil.tasks import demo_sleep
from soil.util import get_download_context


Expand All @@ -24,14 +23,6 @@ def _parse_date(string):
return string


@login_required
def demo(request):
download_id = uuid.uuid4().hex
howlong = int(request.GET.get('secs', 5))
demo_sleep.delay(download_id, howlong)
return HttpResponseRedirect(reverse('retrieve_download', kwargs={'download_id': download_id}))


@login_required
def heartbeat_status(request):
return HttpResponse(json.dumps({"last_timestamp": str(last_heartbeat()),
Expand Down

0 comments on commit 49753fd

Please sign in to comment.