diff --git a/README.md b/README.md index a2e45b1018a148c0f3e2562a819b5c72f38392a4..0886627ef1c1b707ea12ee38e39164d1bdc657ee 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,4 @@ enviroment variables - CSST_DFS_API_MODE = local or cluster # default: local - CSST_LOCAL_FILE_ROOT = [a local file directory] # required if DFS_API_MODE = local, default: /opt/temp/csst - CSST_DFS_GATEWAY = [gateway server's address] # required if DFS_API_MODE = cluster +wsl123 \ No newline at end of file diff --git a/csst_dfs_api/cpic/__init__.py b/csst_dfs_api/cpic/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..be26374fad70948d34d13668a8020ed364fb46ad 100644 --- a/csst_dfs_api/cpic/__init__.py +++ b/csst_dfs_api/cpic/__init__.py @@ -0,0 +1,4 @@ +from .calmerge import CalMergeApi +from .level0 import Level0DataApi +from .level0prc import Level0PrcApi +from .level1 import Level1DataApi \ No newline at end of file diff --git a/csst_dfs_api/cpic/calmerge.py b/csst_dfs_api/cpic/calmerge.py new file mode 100644 index 0000000000000000000000000000000000000000..d073e756f5cf8dc02d64cb8294e289520f3cbf5e --- /dev/null +++ b/csst_dfs_api/cpic/calmerge.py @@ -0,0 +1,92 @@ + +from ..common.delegate import Delegate + +class CalMergeApi(object): + """ + Level 0 Data Operation API + """ + def __init__(self): + self.pymodule = Delegate().load(sub_module = "cpic") + self.stub = getattr(self.pymodule, "CalMergeApi")() + + def find(self, **kwargs): + ''' retrieve calibration merge records from database + + :param kwargs: Parameter dictionary, key items support: + detector_no: [str], + ref_type: [str], + obs_time: (start,end), + qc1_status : [int], + prc_status : [int], + file_name: [str], + limit: limits returns the number of records,default 0:no-limit + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.find(**kwargs) + + def get_latest_by_l0(self, **kwargs): + ''' retrieve calibration merge records from database by level0 data + + :param kwargs: Parameter dictionary, key items support: + level0_id: [str], + ref_type: [str] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.get_latest_by_l0(**kwargs) + + def get(self, **kwargs): + ''' fetch a record from database + + :param kwargs: Parameter dictionary, key items support: + id : [int], + cal_id : [str] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.get(**kwargs) + + def update_proc_status(self, **kwargs): + ''' update the status of reduction + + :param kwargs: Parameter dictionary, key items support: + id : [int], + cal_id : [str], + status : [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.update_proc_status(**kwargs) + + def update_qc1_status(self, **kwargs): + ''' update the status of reduction + + :param kwargs: Parameter dictionary, key items support: + id : [int], + cal_id : [str], + status : [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.update_qc1_status(**kwargs) + + def write(self, **kwargs): + ''' insert a calibration merge record into database + + :param kwargs: Parameter dictionary, key items support: + cal_id : [str], + detector_no : [str], + ref_type : [str], + obs_time : [str], + exp_time : [float], + prc_status : [int], + prc_time : [str], + filename : [str], + file_path : [str], + level0_ids : [list], + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.write(**kwargs) + diff --git a/csst_dfs_api/cpic/level0.py b/csst_dfs_api/cpic/level0.py new file mode 100644 index 0000000000000000000000000000000000000000..65cc3bf2d152a240788872dad95e6d5b9a049e25 --- /dev/null +++ b/csst_dfs_api/cpic/level0.py @@ -0,0 +1,80 @@ + +from ..common.delegate import Delegate + +class Level0DataApi(object): + """ + Level 0 Data Operation API + """ + def __init__(self): + self.pymodule = Delegate().load(sub_module = "cpic") + self.stub = getattr(self.pymodule, "Level0DataApi")() + + def find(self, **kwargs): + ''' retrieve level0 records from database + + :param kwargs: Parameter dictionary, key items support: + obs_id: [str] + detector_no: [str] + obs_type: [str] + obs_time : (start, end), + qc0_status : [int], + prc_status : [int], + file_name: [str] + limit: limits returns the number of records,default 0:no-limit + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.find(**kwargs) + + def get(self, **kwargs): + ''' fetch a record from database + + :param kwargs: Parameter dictionary, key items support: + id : [int], + level0_id: [str] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.get(**kwargs) + + def update_proc_status(self, **kwargs): + ''' update the status of reduction + + :param kwargs: Parameter dictionary, key items support: + id : [int], + level0_id: [str], + status : [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.update_proc_status(**kwargs) + + def update_qc0_status(self, **kwargs): + ''' update the status of QC0 + + :param kwargs: Parameter dictionary, key items support: + id : [int], + level0_id: [str], + status : [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.update_qc0_status(**kwargs) + + def write(self, **kwargs): + ''' insert a level0 data record into database + + :param kwargs: Parameter dictionary, key items support: + obs_id = [str], + detector_no = [str], + obs_type = [str], + obs_time = [str], + exp_time = [int], + detector_status_id = [int], + filename = [str], + file_path = [str] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.write(**kwargs) + diff --git a/csst_dfs_api/cpic/level0prc.py b/csst_dfs_api/cpic/level0prc.py new file mode 100644 index 0000000000000000000000000000000000000000..a9f748d2efd22b3678ff9a406c132bd67e41411c --- /dev/null +++ b/csst_dfs_api/cpic/level0prc.py @@ -0,0 +1,51 @@ + +from ..common.delegate import Delegate + +class Level0PrcApi(object): + """ + Level 0 Data Operation API + """ + def __init__(self): + self.pymodule = Delegate().load(sub_module = "cpic") + self.stub = getattr(self.pymodule, "Level0PrcApi")() + + def find(self, **kwargs): + ''' retrieve level0 procedure records from database + + :param kwargs: Parameter dictionary, key items support: + level0_id: [str] + pipeline_id: [str] + prc_module: [str] + prc_status : [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.find(**kwargs) + + def update_proc_status(self, **kwargs): + ''' update the status of reduction + + :param kwargs: Parameter dictionary, key items support: + id : [int], + status : [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.update_proc_status(**kwargs) + + def write(self, **kwargs): + ''' insert a level0 procedure record into database + + :param kwargs: Parameter dictionary, key items support: + level0_id : [str] + pipeline_id : [str] + prc_module : [str] + params_file_path : [str] + prc_status : [int] + prc_time : [str] + result_file_path : [str] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.write(**kwargs) + diff --git a/csst_dfs_api/cpic/level1.py b/csst_dfs_api/cpic/level1.py new file mode 100644 index 0000000000000000000000000000000000000000..2ead24d17bc4e2efb93d79369957162a9cd0f396 --- /dev/null +++ b/csst_dfs_api/cpic/level1.py @@ -0,0 +1,79 @@ + +from ..common.delegate import Delegate + +class Level1DataApi(object): + """ + Level1 Data Operation Class + """ + def __init__(self): + self.pymodule = Delegate().load(sub_module = "cpic") + self.stub = getattr(self.pymodule, "Level1DataApi")() + + def find(self, **kwargs): + ''' retrieve level1 records from database + + :param kwargs: Parameter dictionary, key items support: + level0_id: [str] + data_type: [str] + create_time : (start, end), + qc1_status : [int], + prc_status : [int], + filename: [str] + limit: limits returns the number of records,default 0:no-limit + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.find(**kwargs) + + def get(self, **kwargs): + ''' fetch a record from database + + :param kwargs: Parameter dictionary, key items support: + id : [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.get(**kwargs) + + + def update_proc_status(self, **kwargs): + ''' update the status of reduction + + :param kwargs: Parameter dictionary, key items support: + id = [int], + status = [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.update_proc_status(**kwargs) + + def update_qc1_status(self, **kwargs): + ''' update the status of QC0 + + :param kwargs: Parameter dictionary, key items support: + id = [int], + status = [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.update_qc1_status(**kwargs) + + def write(self, **kwargs): + ''' insert a level1 record into database + + :param kwargs: Parameter dictionary, key items support: + level0_id: [str] + data_type : [str] + cor_sci_id : [int] + prc_params : [str] + filename : [str] + file_path : [str] + prc_status : [int] + prc_time : [str] + pipeline_id : [str] + refs: [dict] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.write(**kwargs) + diff --git a/csst_dfs_api/cpic/level1prc.py b/csst_dfs_api/cpic/level1prc.py new file mode 100644 index 0000000000000000000000000000000000000000..f886e57ae258978c34423aec20422460a9de6c77 --- /dev/null +++ b/csst_dfs_api/cpic/level1prc.py @@ -0,0 +1,51 @@ + +from ..common.delegate import Delegate + +class Level1PrcApi(object): + """ + Level 0 Data Operation API + """ + def __init__(self): + self.pymodule = Delegate().load(sub_module = "cpic") + self.stub = getattr(self.pymodule, "Level1PrcApi")() + + def find(self, **kwargs): + ''' retrieve level1 procedure records from database + + :param kwargs: Parameter dictionary, key items support: + level1_id: [int] + pipeline_id: [str] + prc_module: [str] + prc_status : [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.find(**kwargs) + + def update_proc_status(self, **kwargs): + ''' update the status of reduction + + :param kwargs: Parameter dictionary, key items support: + id : [int], + status : [int] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.update_proc_status(**kwargs) + + def write(self, **kwargs): + ''' insert a level1 procedure record into database + + :param kwargs: Parameter dictionary, key items support: + level1_id : [int] + pipeline_id : [str] + prc_module : [str] + params_file_path : [str] + prc_status : [int] + prc_time : [str] + result_file_path : [str] + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.write(**kwargs) + diff --git a/csst_dfs_api/facility/level2producer.py b/csst_dfs_api/facility/level2producer.py index 95d97d8cb663e6b47aaf5cce8bbc7eaef8085f24..2f565ccded99eafe19256d0f5091de35e89d3d95 100644 --- a/csst_dfs_api/facility/level2producer.py +++ b/csst_dfs_api/facility/level2producer.py @@ -1,4 +1,4 @@ - +import random from ..common.delegate import Delegate from csst_dfs_commons.models.errors import CSSTGenericException @@ -94,6 +94,7 @@ class Level2ProducerApi(object): ''' new a Level2Producer Job :param kwargs: Parameter dictionary, key items support: + name = [str] dag = [str] :returns: csst_dfs_common.models.Result @@ -115,6 +116,7 @@ class Level2ProducerApi(object): :param kwargs: Parameter dictionary, key items support: id = [int] + name = [str] dag = [str] status = [int] @@ -191,7 +193,8 @@ class Level2ProducerApi(object): graph_id_edges = [(pre_node.id, n.id) for n in the_nodes.data] pos = {pre_node.name: (node_level_x,node_level_y)} for idx, node in enumerate(the_nodes.data): - sub_id_edges, sub_name_edges, sub_pos = get_next(node, node_level_x+1, idx-len(the_nodes.data)/2) + sub_id_edges, sub_name_edges, sub_pos = get_next(node, node_level_x+1, random.randint(-3,3)) + graph_id_edges.extend(sub_id_edges) graph_name_edges.extend(sub_name_edges) pos.update(sub_pos) @@ -206,15 +209,15 @@ class Level2ProducerApi(object): g1.add_nodes_from(vertex_list) g1.add_edges_from(graph_name_edges) plt.xlim(-1, 8) - plt.ylim(-3, 3) + plt.ylim(-4, 4) plt.tight_layout() nx.draw( g1, pos = pos, node_color = 'orange', edge_color = 'black', - font_size =10, - node_size =300, + font_size =12, + node_size =360, with_labels=True ) diff --git a/tests/cpic/test_cpic_cal_merge.py b/tests/cpic/test_cpic_cal_merge.py new file mode 100644 index 0000000000000000000000000000000000000000..b11865b261d6f313573e08a341271c88b1dfc6f1 --- /dev/null +++ b/tests/cpic/test_cpic_cal_merge.py @@ -0,0 +1,48 @@ +import os +import unittest +from astropy.io import fits + +from csst_dfs_api.cpic.calmerge import CalMergeApi + +class SLSCalMergeApiTestCase(unittest.TestCase): + + def setUp(self): + self.api = CalMergeApi() + + def test_find(self): + recs = self.api.find(detector_no='CCD01', + ref_type = "bias", + obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13")) + print('find:', recs) + + def test_get_latest_by_l0(self): + rec = self.api.get_latest_by_l0(level0_id='000001102', ref_type = "bias") + print('get_latest_by_l0:', rec) + + def test_get(self): + rec = self.api.get(id = 2) + print('get by id:', rec) + rec = self.api.get(cal_id = '2') + print('get by cal_id:', rec) + + # def test_update_proc_status(self): + # rec = self.api.update_proc_status(id = 3, status = 1) + # print('update_proc_status:', rec) + + # def test_update_qc1_status(self): + # rec = self.api.update_qc1_status(id = 3, status = 2) + # print('update_qc1_status:', rec) + + # def test_write(self): + # rec = self.api.write( + # cal_id = '00002', + # detector_no = '01', + # ref_type = "bias", + # obs_time = "2021-06-04 11:12:13", + # exp_time = 150, + # filename = "/opt/dddasd1.params", + # file_path = "/opt/dddasd1.fits", + # prc_status = 3, + # prc_time = '2021-06-04 11:12:13', + # level0_ids = ['1','2','3','4']) + # print('write:', rec) \ No newline at end of file diff --git a/tests/cpic/test_cpic_level0.py b/tests/cpic/test_cpic_level0.py new file mode 100644 index 0000000000000000000000000000000000000000..e9bc6a90a7dc04231f974e53db2055751cd1aef7 --- /dev/null +++ b/tests/cpic/test_cpic_level0.py @@ -0,0 +1,42 @@ +import os +import unittest +from astropy.io import fits + +from csst_dfs_api.cpic.level0 import Level0DataApi + +class CPICLevel0DataTestCase(unittest.TestCase): + + def setUp(self): + self.api = Level0DataApi() + + def test_find(self): + recs = self.api.find(obs_id = '000009', obs_type = 'sci', limit = 0) + print('find:', recs) + + def test_get(self): + rec = self.api.get(id = 100) + print('get:', rec) + + rec = self.api.get(level0_id = '1000000102') + print('get:', rec) + + def test_update_proc_status(self): + rec = self.api.update_proc_status(level0_id = '000001102', status = 6) + print('update_proc_status:', rec) + + def test_update_qc0_status(self): + rec = self.api.update_qc0_status(level0_id = '000001102', status = 7) + print('update_qc0_status:', rec) + + def test_write(self): + rec = self.api.write( + level0_id = '000001101', + obs_id = '0000011', + detector_no = "01", + obs_type = "sci", + obs_time = "2021-06-06 11:12:13", + exp_time = 150, + detector_status_id = 3, + filename = "MSC_00001234", + file_path = "/opt/MSC_00001234.fits") + print('write:', rec) \ No newline at end of file diff --git a/tests/cpic/test_cpic_level0_prc.py b/tests/cpic/test_cpic_level0_prc.py new file mode 100644 index 0000000000000000000000000000000000000000..523fb72b6529a2013637c9ccf5496bed362ff5b9 --- /dev/null +++ b/tests/cpic/test_cpic_level0_prc.py @@ -0,0 +1,29 @@ +import os +import unittest +from astropy.io import fits + +from csst_dfs_api.cpic.level0prc import Level0PrcApi + +class CPICLevel0PrcTestCase(unittest.TestCase): + + def setUp(self): + self.api = Level0PrcApi() + + def test_find(self): + recs = self.api.find(level0_id='134') + print('find:', recs) + + def test_update_proc_status(self): + rec = self.api.update_proc_status(id = 8, status = 4) + print('update_proc_status:', rec) + + def test_write(self): + rec = self.api.write( + level0_id='134', + pipeline_id = "P1", + prc_module = "QC0", + params_file_path = "/opt/dddasd.params", + prc_status = 3, + prc_time = '2021-06-04 11:12:13', + result_file_path = "/opt/dddasd.header") + print('write:', rec) \ No newline at end of file diff --git a/tests/cpic/test_cpic_level1.py b/tests/cpic/test_cpic_level1.py new file mode 100644 index 0000000000000000000000000000000000000000..776495425682a9cdf9de749f2a9f4c2bb3758615 --- /dev/null +++ b/tests/cpic/test_cpic_level1.py @@ -0,0 +1,40 @@ +import unittest + +from csst_dfs_api.cpic import Level1DataApi + +class CPICResult1TestCase(unittest.TestCase): + + def setUp(self): + self.api = Level1DataApi() + + def test_find(self): + recs = self.api.find( + level0_id='0000223', + create_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13") + ) + print('find:', recs) + + def test_get(self): + rec = self.api.get(id = 1) + print('get:', rec) + + def test_update_proc_status(self): + rec = self.api.update_proc_status(id = 1, status = 4) + print('update_proc_status:', rec) + + def test_update_qc1_status(self): + rec = self.api.update_qc1_status(id = 1, status = 7) + print('update_qc1_status:', rec) + + def test_write(self): + rec = self.api.write( + level0_id='0000223', + data_type = "sci", + prc_params = "/opt/dddasd.params", + prc_status = 3, + prc_time = '2021-10-22 11:12:13', + filename = "MSC_MS_210525121500_100000001_09_raw", + file_path = "/opt/temp/csst/MSC_MS_210525121500_100000001_09_raw.fits", + pipeline_id = "P2", + refs = {'dark': 1, 'bias': 2, 'flat': 3 }) + print('write:', rec) \ No newline at end of file diff --git a/tests/cpic/test_cpic_level1_prc.py b/tests/cpic/test_cpic_level1_prc.py new file mode 100644 index 0000000000000000000000000000000000000000..8ddec6976006add8f479865edd0c6320b4e26a64 --- /dev/null +++ b/tests/cpic/test_cpic_level1_prc.py @@ -0,0 +1,28 @@ +import os +import unittest +from astropy.io import fits + +from csst_dfs_api.cpic.level1prc import Level1PrcApi + +class CPICLevel1PrcTestCase(unittest.TestCase): + + def setUp(self): + self.api = Level1PrcApi() + + def test_find(self): + recs = self.api.find(level1_id=1) + print('find:', recs) + + def test_update_proc_status(self): + rec = self.api.update_proc_status(id = 1, status = 4) + print('update_proc_status:', rec) + + def test_write(self): + rec = self.api.write(level1_id=1, + pipeline_id = "P1", + prc_module = "QC0", + params_file_path = "/opt/dddasd.params", + prc_status = 3, + prc_time = '2021-06-04 11:12:13', + result_file_path = "/opt/dddasd.header") + print('write:', rec) \ No newline at end of file diff --git a/tests/facility/test_facility_level2producer.py b/tests/facility/test_facility_level2producer.py index 480379f791d865813e2771e92e4022a9156f5ac1..4ead90bdcb382be947be9b5d40fdd7cf1e36e41e 100644 --- a/tests/facility/test_facility_level2producer.py +++ b/tests/facility/test_facility_level2producer.py @@ -11,6 +11,7 @@ class FacilityLevel2ProducerTestCase(unittest.TestCase): rec = self.api.register(name='Test2', gitlink='http://github.com/xxx/xxx', paramfiles='/opt/csst/param1.ini', + image='centos:7', priority = 3, pre_producers=[1,2] ) print('register:', rec) @@ -36,6 +37,7 @@ class FacilityLevel2ProducerTestCase(unittest.TestCase): id=2, name = "start2", gitlink = "http://github.com/xxx/xxx", + image = "centos:8", paramfiles='/opt/csst/param1.ini', priority = 3, pre_producers=[1,3] @@ -50,7 +52,8 @@ class FacilityLevel2ProducerTestCase(unittest.TestCase): def test_new_job(self): recs = self.api.new_job( - dag = "start2-1-1-" + name = "start2-1-1-", + dag = "{'start':'1'}" ) print('new_job:', recs) @@ -108,6 +111,6 @@ class FacilityLevel2ProducerTestCase(unittest.TestCase): def test_make_graph(self): graph_id_edges = self.api.make_graph( start_producer_id = 2, - fig_path = 'graph.png' + fig_path = 'graph11.png' ) print('graph_id_edges:', graph_id_edges) \ No newline at end of file diff --git a/tests/mci/test_mci_level0.py b/tests/mci/test_mci_level0.py index 9458d209f37e4149735406a73e6a9f3ee1e6f72f..8954af030f421ae170b7f7c2d15d971e1992c112 100644 --- a/tests/mci/test_mci_level0.py +++ b/tests/mci/test_mci_level0.py @@ -10,25 +10,25 @@ class MCILevel0DataTestCase(unittest.TestCase): self.api = Level0DataApi() def test_find(self): - recs = self.api.find(obs_id = '000009', obs_type = 'sci', limit = 0) + recs = self.api.find(limit = 0) print('find:', recs) def test_get(self): - rec = self.api.get(id = 100) + rec = self.api.get(id = 1) print('get:', rec) - rec = self.api.get(level0_id = '1000000102') + rec = self.api.get(level0_id = '200000006-') print('get:', rec) - def test_update_proc_status(self): - rec = self.api.update_proc_status(level0_id = '000001102', status = 6) - print('update_proc_status:', rec) + # def test_update_proc_status(self): + # rec = self.api.update_proc_status(level0_id = '000001102', status = 6) + # print('update_proc_status:', rec) - def test_update_qc0_status(self): - rec = self.api.update_qc0_status(level0_id = '000001102', status = 7) - print('update_qc0_status:', rec) + # def test_update_qc0_status(self): + # rec = self.api.update_qc0_status(level0_id = '000001102', status = 7) + # print('update_qc0_status:', rec) - def test_write(self): - rec = self.api.write( - file_path = "/opt/MSC_00001234.fits") - print('write:', rec) \ No newline at end of file + # def test_write(self): + # rec = self.api.write( + # file_path = "/opt/MSC_00001234.fits") + # print('write:', rec) \ No newline at end of file diff --git a/tests/msc/test_msc_cal_merge.py b/tests/msc/test_msc_cal_merge.py index 8559445988ce45b77189a70708d20835ebb91b91..2037ce98c36bc6b55c9564e3fdf38245f39538c2 100644 --- a/tests/msc/test_msc_cal_merge.py +++ b/tests/msc/test_msc_cal_merge.py @@ -9,15 +9,15 @@ class MSCCalMergeApiTestCase(unittest.TestCase): def setUp(self): self.api = CalMergeApi() - # def test_find(self): - # recs = self.api.find(detector_no='CCD01', - # ref_type = "bias", - # obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13")) - # print('find:', recs) + def test_find(self): + recs = self.api.find(detector_no='CCD01', + ref_type = "bias", + obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13")) + print('find:', recs) - # def test_get_latest_by_l0(self): - # rec = self.api.get_latest_by_l0(level0_id='000001102', ref_type = "bias") - # print('get_latest_by_l0:', rec) + def test_get_latest_by_l0(self): + rec = self.api.get_latest_by_l0(level0_id='000001102', ref_type = "bias") + print('get_latest_by_l0:', rec) def test_get(self): rec = self.api.get(id = 2) @@ -25,24 +25,24 @@ class MSCCalMergeApiTestCase(unittest.TestCase): rec = self.api.get(cal_id = '2') print('get by cal_id:', rec) - # def test_update_proc_status(self): - # rec = self.api.update_proc_status(id = 3, status = 1) - # print('update_proc_status:', rec) - - # def test_update_qc1_status(self): - # rec = self.api.update_qc1_status(id = 3, status = 2) - # print('update_qc1_status:', rec) - - # def test_write(self): - # rec = self.api.write( - # cal_id = '00002', - # detector_no = '01', - # ref_type = "bias", - # obs_time = "2021-06-04 11:12:13", - # exp_time = 150, - # filename = "/opt/dddasd1.params", - # file_path = "/opt/dddasd1.fits", - # prc_status = 3, - # prc_time = '2021-06-04 11:12:13', - # level0_ids = ['1','2','3','4']) - # print('write:', rec) \ No newline at end of file + def test_update_proc_status(self): + rec = self.api.update_proc_status(id = 3, status = 1) + print('update_proc_status:', rec) + + def test_update_qc1_status(self): + rec = self.api.update_qc1_status(id = 3, status = 2) + print('update_qc1_status:', rec) + + def test_write(self): + rec = self.api.write( + cal_id = '00002', + detector_no = '01', + ref_type = "bias", + obs_time = "2021-06-04 11:12:13", + exp_time = 150, + filename = "/opt/dddasd1.params", + file_path = "/opt/dddasd1.fits", + prc_status = 3, + prc_time = '2021-06-04 11:12:13', + level0_ids = ['1','2','3','4']) + print('write:', rec) \ No newline at end of file diff --git a/tests/msc/test_msc_level0.py b/tests/msc/test_msc_level0.py index 39e045c24c3d8a2d07863bb81dd5bfc73f84c5a7..a19998cdd6aaeb2f1f2abba4674c64897c947b7c 100644 --- a/tests/msc/test_msc_level0.py +++ b/tests/msc/test_msc_level0.py @@ -10,14 +10,14 @@ class MSCLevel0DataTestCase(unittest.TestCase): self.api = Level0DataApi() def test_find(self): - recs = self.api.find(obs_id = '000009', obs_type = 'sci', limit = 0) + recs = self.api.find(obs_id = '100000154', obs_type = 'sci', limit = 0) print('find:', recs) def test_get(self): - rec = self.api.get(id = 100) + rec = self.api.get(id = 2) print('get:', rec) - rec = self.api.get(level0_id = '1000000102') + rec = self.api.get(level0_id = '10000000123') print('get:', rec) def test_update_proc_status(self): diff --git a/tests/msc/test_msc_level2.py b/tests/msc/test_msc_level2.py index 47e5e01bb8cb2e3a48d3f9b76bb603a5c688e1d9..98f8413e2c84f73fba5afd8f3704294de1cfdbfc 100644 --- a/tests/msc/test_msc_level2.py +++ b/tests/msc/test_msc_level2.py @@ -9,32 +9,34 @@ class MSCLevel2DataTestCase(unittest.TestCase): def setUp(self): self.api = Level2DataApi() - # def test_find(self): - # recs = self.api.find( - # level1_id=1, - # create_time = ("2022-06-15 11:12:13","2022-06-16 11:12:13")) - # print('find:', recs) - - # def test_catalog_query(self): - # result = self.api.catalog_query( - # obs_id='100000000', - # obs_time = ("2021-05-24 11:12:13","2021-05-25 13:12:13"), - # limit = 2) - # dt = self.api.to_table(result) - # print(result) - # dt.pprint() - - # def test_get(self): - # rec = self.api.get(id = 1) - # print('get:', rec) - - # def test_update_proc_status(self): - # rec = self.api.update_proc_status(id = 1, status = 4) - # print('update_proc_status:', rec) - - # def test_update_qc2_status(self): - # rec = self.api.update_qc2_status(id = 1, status = 7) - # print('update_qc2_status:', rec) + def test_find(self): + recs = self.api.find( + level1_id=1, + create_time = ("2022-06-15 11:12:13","2022-06-16 11:12:13")) + print('find:', recs) + + def test_catalog_query(self): + result = self.api.catalog_query( + obs_id='100000000', + obs_time = ("2021-05-24 11:12:13","2021-05-25 13:12:13"), + limit = 2) + if result.success: + dt = self.api.to_table(result) + dt.pprint() + else: + print(result) + + def test_get(self): + rec = self.api.get(id = 1) + print('get:', rec) + + def test_update_proc_status(self): + rec = self.api.update_proc_status(id = 1, status = 4) + print('update_proc_status:', rec) + + def test_update_qc2_status(self): + rec = self.api.update_qc2_status(id = 1, status = 7) + print('update_qc2_status:', rec) def test_write(self): rec = self.api.write(