diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 096886f..a258940 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -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: | diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..df8a0c2 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,5 @@ +include LICENSE +include README.md +include requirements.txt +include versioneer.py +include analysisstore/_version.py diff --git a/analysisstore/server/astore.py b/analysisstore/server/astore.py index 2f423ac..2bbbc25 100644 --- a/analysisstore/server/astore.py +++ b/analysisstore/server/astore.py @@ -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, @@ -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): @@ -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, @@ -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): diff --git a/analysisstore/server/engine.py b/analysisstore/server/engine.py index a847e23..a2f9f26 100644 --- a/analysisstore/server/engine.py +++ b/analysisstore/server/engine.py @@ -1,4 +1,5 @@ from __future__ import (absolute_import, print_function) +from tornado import gen import tornado.ioloop import tornado.web import pymongo @@ -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') @@ -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: @@ -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: @@ -89,7 +90,7 @@ def get_queryable(self, func): class ConnStatHandler(DefaultHandler): - @tornado.web.asynchronous + @gen.coroutine def get(self): self.finish() @@ -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) @@ -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, diff --git a/requirements.txt b/requirements.txt index 0dd51b4..45dbdec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,5 @@ jsonschema pymongo pyyaml requests -tornado<5 +tornado ujson