Skip to content
Snippets Groups Projects
Commit 06eb98ae authored by Nathaniel Kofalt's avatar Nathaniel Kofalt
Browse files

Remove hacks

parent ae709542
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,6 @@ routes = [ ...@@ -58,7 +58,6 @@ routes = [
webapp2.Route(r'/reaper', core.Core, handler_method='reaper', methods=['POST']), webapp2.Route(r'/reaper', core.Core, handler_method='reaper', methods=['POST']),
webapp2.Route(r'/sites', core.Core, handler_method='sites', methods=['GET']), webapp2.Route(r'/sites', core.Core, handler_method='sites', methods=['GET']),
webapp2.Route(r'/config', core.Config, methods=['GET']), webapp2.Route(r'/config', core.Config, methods=['GET']),
webapp2.Route(r'/hack', core.Core, handler_method='hack', methods=['GET']),
webapp2.Route(r'/config.js', core.Config, handler_method='get_js', methods=['GET']) webapp2.Route(r'/config.js', core.Config, handler_method='get_js', methods=['GET'])
]), ]),
webapp2.Route(r'/api/users', userhandler.UserHandler, handler_method='get_all', methods=['GET']), webapp2.Route(r'/api/users', userhandler.UserHandler, handler_method='get_all', methods=['GET']),
......
...@@ -14,8 +14,6 @@ from . import base ...@@ -14,8 +14,6 @@ from . import base
from . import files from . import files
from . import util from . import util
from . import config from . import config
from . import jobs
from . import rules
from .dao import reaperutil from .dao import reaperutil
from . import tempdir as tempfile from . import tempdir as tempfile
...@@ -43,52 +41,6 @@ class Core(base.RequestHandler): ...@@ -43,52 +41,6 @@ class Core(base.RequestHandler):
"""Return 200 OK.""" """Return 200 OK."""
pass pass
def hack(self):
for c_type in ['projects', 'collections', 'sessions', 'acquisitions']:
# This projection needs every field required to know what type of container it is & navigate to its project
containers = config.db[c_type].find({'files.unprocessed': True}, ['files', 'session', 'project'])
for c in containers:
for f in c['files']:
if f.get('unprocessed'):
rules.create_jobs(config.db, c, c_type, f)
r = config.db[c_type].update_one(
{
'_id': c['_id'],
'files': {
'$elemMatch': {
'name': f['name'],
'hash': f['hash'],
},
},
},
{
'$set': {
'files.$.unprocessed': False,
},
},
)
if not r.matched_count:
log.info('file modified or removed, not marked as clean: %s %s, %s' % (c_type, c, f['name']))
while True:
j = config.db.jobs.find_one_and_update(
{
'state': 'running',
'modified': {'$lt': datetime.datetime.utcnow() - datetime.timedelta(seconds=100)},
},
{
'$set': {
'state': 'failed',
},
},
)
if j is None:
break
else:
jobs.retry_job(config.db, j)
def get(self): def get(self):
"""Return API documentation""" """Return API documentation"""
resources = """ resources = """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment