Skip to content

Commit

Permalink
Merge pull request #21 from JunAishima/upgrade-tornado
Browse files Browse the repository at this point in the history
upgrade tornado to > 5
  • Loading branch information
mrakitin authored Jan 27, 2022
2 parents 55e5a40 + 3099d3f commit db7e68c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
if: matrix.dependencies == 'conda'
run: |
set -vxeo pipefail
conda install -y -c conda-forge six mongoquery doct jsonschema mock pymongo pytest pyyaml requests "tornado<5" ujson
conda install -y -c conda-forge six mongoquery doct jsonschema mock pymongo pytest pyyaml requests tornado ujson
- name: Install the package
run: |
Expand Down
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include LICENSE
include README.md
include requirements.txt
include versioneer.py
include analysisstore/_version.py
8 changes: 4 additions & 4 deletions analysisstore/server/astore.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def insert_analysis_header(self, time, uid, provenance, **kwargs):
Unique identifier of the document inserted
"""
doc = dict(time=time, uid=uid, provenance=provenance, **kwargs)
self.database.analysis_header.insert(doc)
self.database.analysis_header.insert_one(doc)
return uid

def insert_data_reference_header(self, time, uid, analysis_header,
Expand Down Expand Up @@ -145,7 +145,7 @@ def insert_data_reference_header(self, time, uid, analysis_header,
doc = dict(time=time, uid=uid, analysis_header=analysis_header,
data_keys=data_keys,
**kwargs)
self.database.data_reference_header.insert(doc)
self.database.data_reference_header.insert_one(doc)
return uid

def bulk_data_reference_insert(self, data_header, data_references):
Expand Down Expand Up @@ -185,7 +185,7 @@ def insert_data_reference(self, time, uid, data_reference_header,
dhdr = self.doc_or_uid_to_uid(data_reference_header)
doc = dict(time=time, uid=uid, data_reference_header=dhdr,
data=data, timestamps=timestamps, **kwargs)
self.database.data_reference.insert(doc)
self.database.data_reference.insert_one(doc)
return uid

def insert_analysis_tail(self, time, uid, analysis_header, exit_status,
Expand Down Expand Up @@ -213,7 +213,7 @@ def insert_analysis_tail(self, time, uid, analysis_header, exit_status,
hdr = self.doc_or_uid_to_uid(analysis_header)
doc = dict(time=time, uid=uid, analysis_header=analysis_header,
exit_status=exit_status, **kwargs)
self.database.analysis_tail.insert(doc)
self.database.analysis_tail.insert_one(doc)
return uid

def _clean_ids(self, cursor):
Expand Down
13 changes: 7 additions & 6 deletions analysisstore/server/engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import (absolute_import, print_function)
from tornado import gen
import tornado.ioloop
import tornado.web
import pymongo
Expand All @@ -17,7 +18,7 @@ class DefaultHandler(tornado.web.RequestHandler):
def initialize(self):
self.astore = self.settings['astore']

@tornado.web.asynchronous
@gen.coroutine
def set_default_headers(self):
self.set_header('Access-Control-Allow-Origin', '*')
self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
Expand All @@ -40,7 +41,7 @@ def report_error(self, code, status, mstr=''):
fmsg = str(status) + ' ' + str(mstr)
raise tornado.web.HTTPError(status_code=code, reason=fmsg)

@tornado.web.asynchronous
@gen.coroutine
def get(self):
query = self.load_query()
try:
Expand All @@ -59,7 +60,7 @@ def get(self):
self.write(json.dumps(list(docs_gen)))
self.finish()

@tornado.web.asynchronous
@gen.coroutine
def post(self):
data = self.load_data()
try:
Expand Down Expand Up @@ -89,7 +90,7 @@ def get_queryable(self, func):


class ConnStatHandler(DefaultHandler):
@tornado.web.asynchronous
@gen.coroutine
def get(self):
self.finish()

Expand Down Expand Up @@ -144,7 +145,7 @@ class DataReferenceHeaderHandler(DefaultHandler):
Insert a event_header document.Same validation method as bluesky, secondary
safety net.
"""
@tornado.web.asynchronous
@gen.coroutine
def initialize(self):
self.astore = self.settings['astore']
self.insertables = dict(insert_data_reference_header=self.astore.insert_data_reference_header)
Expand All @@ -163,7 +164,7 @@ class DataReferenceHandler(DefaultHandler):
Insert a event document.Same validation method as bluesky, secondary
safety net.
"""
@tornado.web.asynchronous
@gen.coroutine
def initialize(self):
self.astore = self.settings['astore']
self.insertables = dict(insert_data_reference=self.astore.insert_data_reference,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ jsonschema
pymongo
pyyaml
requests
tornado<5
tornado
ujson

0 comments on commit db7e68c

Please sign in to comment.