File tree 3 files changed +11
-11
lines changed
3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ services:
36
36
- " 5672:5672"
37
37
38
38
mongodb :
39
- image : mongo:3.2
39
+ image : mongo:3.6
40
40
restart : unless-stopped
41
41
volumes :
42
42
- ${PROTES_DATA_DIR:-../data/pro_tes}/db:/data/db
Original file line number Diff line number Diff line change @@ -272,15 +272,17 @@ def list_tasks(self, **kwargs) -> dict:
272
272
)
273
273
page_token = kwargs .get ("page_token" )
274
274
filter_dict = {}
275
- filter_dict ["user_id" ] = kwargs .get ("user_id" )
275
+
276
+ user_id = kwargs .get ("user_id" )
277
+ if user_id is not None :
278
+ filter_dict ["user_id" ] = user_id
276
279
277
280
if page_token is not None :
278
281
filter_dict ["_id" ] = {"$lt" : ObjectId (page_token )}
279
282
view = kwargs .get ("view" , "BASIC" )
280
283
projection = self ._set_projection (view = view )
281
284
282
- name_prefix : str = str (kwargs .get ("name_prefix" ))
283
-
285
+ name_prefix = kwargs .get ("name_prefix" )
284
286
if name_prefix is not None :
285
287
filter_dict ["task_original.name" ] = {"$regex" : f"^{ name_prefix } " }
286
288
@@ -437,7 +439,7 @@ def _write_doc_to_db(
437
439
)
438
440
document .worker_id = uuid ()
439
441
try :
440
- self .db_client .insert (document .dict (exclude_none = True ))
442
+ self .db_client .insert_one (document .dict (exclude_none = True ))
441
443
except DuplicateKeyError :
442
444
continue
443
445
assert document is not None
Original file line number Diff line number Diff line change 2
2
3
3
import logging
4
4
from typing import Mapping , Optional
5
- from pymongo .collection import ReturnDocument # type: ignore
6
- from pymongo import collection as Collection # type: ignore
7
-
5
+ from pymongo .collection import ReturnDocument , Collection
8
6
from pro_tes .ga4gh .tes .models import DbDocument , TesState
9
7
10
8
logger = logging .getLogger (__name__ )
@@ -56,7 +54,7 @@ def get_document(
56
54
projection = projection ,
57
55
)
58
56
try :
59
- document : DbDocument = DbDocument (** document_unvalidated )
57
+ document : DbDocument = DbDocument (** ( document_unvalidated or {}) )
60
58
except Exception as exc :
61
59
raise ValueError (
62
60
"Database document does not conform to schema: "
@@ -110,8 +108,8 @@ def upsert_fields_in_root_object(
110
108
{"worker_id" : self .worker_id },
111
109
{
112
110
"$set" : {
113
- "." .join ([root , key ]): value
114
- for ( key , value ) in kwargs .items ()
111
+ "." .join ([root , key ]): value for ( key , value ) in
112
+ kwargs .items ()
115
113
}
116
114
},
117
115
projection = projection ,
You can’t perform that action at this time.
0 commit comments