Commit d2e89420 authored by Wei Shoulin's avatar Wei Shoulin
Browse files

Iterable brick_ids

parent ebd97b29
...@@ -4,6 +4,8 @@ import grpc ...@@ -4,6 +4,8 @@ import grpc
import datetime import datetime
import pickle import pickle
from collections import Iterable
from csst_dfs_commons.models import Result from csst_dfs_commons.models import Result
from csst_dfs_commons.models.common import from_proto_model_list from csst_dfs_commons.models.common import from_proto_model_list
from csst_dfs_commons.models.msc import Level2Record,Level2CatalogRecord from csst_dfs_commons.models.msc import Level2Record,Level2CatalogRecord
...@@ -76,8 +78,13 @@ class Level2DataApi(object): ...@@ -76,8 +78,13 @@ class Level2DataApi(object):
try: try:
datas = io.BytesIO() datas = io.BytesIO()
totalCount = 0 totalCount = 0
brick_ids = get_parameter(kwargs, "brick_ids", [])
if not isinstance(brick_ids,Iterable):
brick_ids = [brick_ids]
resps = self.stub.FindCatalog(level2_pb2.FindLevel2CatalogReq( resps = self.stub.FindCatalog(level2_pb2.FindLevel2CatalogReq(
brick_ids = ",".join([str(i) for i in get_parameter(kwargs, "brick_ids", [])]), brick_ids = ",".join([str(i) for i in brick_ids]),
obs_id = get_parameter(kwargs, "obs_id", None), obs_id = get_parameter(kwargs, "obs_id", None),
detector_no = get_parameter(kwargs, "detector_no", None), detector_no = get_parameter(kwargs, "detector_no", None),
filter = get_parameter(kwargs, "filter", None), filter = get_parameter(kwargs, "filter", None),
...@@ -121,8 +128,13 @@ class Level2DataApi(object): ...@@ -121,8 +128,13 @@ class Level2DataApi(object):
return: csst_dfs_common.models.Result return: csst_dfs_common.models.Result
''' '''
try: try:
brick_ids = get_parameter(kwargs, "brick_ids", [])
if not isinstance(brick_ids,Iterable):
brick_ids = [brick_ids]
resp, _ = self.stub.FindCatalogFile.with_call(level2_pb2.FindLevel2CatalogReq( resp, _ = self.stub.FindCatalogFile.with_call(level2_pb2.FindLevel2CatalogReq(
brick_ids = ",".join([str(i) for i in get_parameter(kwargs, "brick_ids", [])]), brick_ids = ",".join([str(i) for i in brick_ids]),
obs_id = get_parameter(kwargs, "obs_id"), obs_id = get_parameter(kwargs, "obs_id"),
detector_no = get_parameter(kwargs, "detector_no"), detector_no = get_parameter(kwargs, "detector_no"),
filter = get_parameter(kwargs, "filter", None), filter = get_parameter(kwargs, "filter", None),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment