Commit 458a7ed8 authored by Wei Shoulin's avatar Wei Shoulin
Browse files

file_type -> data_type

parent 6612f40d
......@@ -9,7 +9,7 @@ def find(project_id: Optional[str] = None,
level0_id: Optional[str] = None,
module_id: Literal['MSC', 'IFS', 'MCI', 'HSTDM', 'CPIC'] = 'MSC',
detector_no: Optional[str] = None,
file_type: Optional[str] = None,
data_type: Optional[str] = None,
filter: Optional[str] = None,
obs_time: Optional[DateTimeTuple] = None,
create_time: Optional[DateTimeTuple] = None,
......@@ -34,7 +34,7 @@ def find(project_id: Optional[str] = None,
obs_id (Optional[str], optional): 观测ID. Defaults to None.
module_id (Optional[str], optional): 模块ID,如'MSC', 'IFS'. Defaults to None.
detector_no (Optional[str], optional): 探测器编号. Defaults to None.
file_type (Optional[str], optional): 文件类型,如'SCI'. Defaults to None.
data_type (Optional[str], optional): 文件类型,如'csst-msc-l1-mbi'. Defaults to None.
filter (Optional[str], optional): 滤光片. Defaults to None.
obs_time (Optional[DateTimeTuple], optional): 观测时间范围. Defaults to None.
create_time (Optional[DateTimeTuple], optional): 创建时间范围. Defaults to None.
......@@ -63,7 +63,7 @@ def find(project_id: Optional[str] = None,
'obs_id': obs_id,
'module_id': module_id,
'detector_no': detector_no,
'file_type': file_type,
'data_type': data_type,
'filter': filter,
'qc1_status': qc1_status,
'prc_status': prc_status,
......@@ -122,40 +122,40 @@ def find_by_brick_id(brick_id: int) -> Result:
def sls_find_by_qc1_status(qc1_status: int, limit: int = 1, batch_id: str = constants.DEFAULT_BATCH_ID) -> Result:
return request.post(f"/api/level1/sls/qc1_status/{qc1_status}", {'limit': limit, 'batch_id': batch_id})
def update_qc1_status(level1_id: str, file_type: str, qc1_status: int, batch_id: str = constants.DEFAULT_BATCH_ID) -> Result:
def update_qc1_status(level1_id: str, data_type: str, qc1_status: int, batch_id: str = constants.DEFAULT_BATCH_ID) -> Result:
"""
更新1级数据的QC0状态
Args:
level1_id (str): 1级数据的ID
file_type (str): 文件类型
data_type (str): 文件类型
qc1_status (int): QC0状态
batch_id (str): 批次ID
Returns:
Result: 更新结果
"""
return request.put(f"/api/level1/qc1_status/{level1_id}", {'file_type': file_type, 'qc1_status': qc1_status, 'batch_id': batch_id})
return request.put(f"/api/level1/qc1_status/{level1_id}", {'data_type': data_type, 'qc1_status': qc1_status, 'batch_id': batch_id})
def update_prc_status(level1_id: str, file_type: str, prc_status: int, batch_id: str = constants.DEFAULT_BATCH_ID) -> Result:
def update_prc_status(level1_id: str, data_type: str, prc_status: int, batch_id: str = constants.DEFAULT_BATCH_ID) -> Result:
"""
更新1级数据的处理状态
Args:
level1_id (str): 1级数据的ID
file_type (str): 文件类型
data_type (str): 文件类型
prc_status (int): 处理状态
batch_id (str): 批次ID
Returns:
Result: 操作结果
"""
return request.put(f"/api/level1/prc_status/{level1_id}", {'file_type': file_type, 'prc_status': prc_status, 'batch_id': batch_id})
return request.put(f"/api/level1/prc_status/{level1_id}", {'data_type': data_type, 'prc_status': prc_status, 'batch_id': batch_id})
def write(local_file: Union[IO, str],
module_id: Literal['MSC', 'IFS', 'MCI', 'HSTDM', 'CPIC'],
level1_id: str,
file_type: str,
data_type: str,
file_name: str,
dag_id: str,
pmapname: str,
......@@ -173,7 +173,7 @@ def write(local_file: Union[IO, str],
module_id ['MSC', 'IFS', 'MCI', 'HSTDM', 'CPIC']其中一个,代表: 模块ID
level0_id (Optional[str]): 0级数据的ID默认为 None
level1_id (str): 1级数据的ID
file_type (str): 文件类型
data_type (str): 文件类型
file_name (str): 1级数据文件名
dag_id (str): 管线ID
pmapname (str): CCDS pmap名称
......@@ -190,7 +190,7 @@ def write(local_file: Union[IO, str],
'module_id': module_id,
'level0_id': level0_id,
'level1_id': level1_id,
'file_type': file_type,
'data_type': data_type,
'file_name': file_name,
'dag_id': dag_id,
'pmapname': pmapname,
......
......@@ -52,9 +52,9 @@
- 返回值:查询结果对象。
10. **add_process**
- 功能:添加1级数据处理记录。
- 参数:1级数据的ID、管线ID、运行ID、数据集、批次ID、处理时间、处理状态、处理模块、处理消息。
- 返回值:操作结果对象。
- 功能:添加1级数据处理记录。
- 参数:1级数据的ID、管线ID、运行ID、数据集、批次ID、处理时间、处理状态、处理模块、处理消息。
- 返回值:操作结果对象。
## 使用示例
......@@ -94,7 +94,7 @@ print(result) # result.data为list类型,包含1级数据文件记录列表
```python
from csst_dfs_client import level1
result = level1.update_qc1_status(level1_id='some_level1_id', filetype='SCI', qc1_status=1, batch_id='some_batch_id')
result = level1.update_qc1_status(level1_id='some_level1_id', data_type='SCI', qc1_status=1, batch_id='some_batch_id')
print(result)
```
......@@ -102,7 +102,7 @@ print(result)
```python
from csst_dfs_client import level1
result = level1.update_prc_status(level1_id='some_level1_id', filetype='SCI', prc_status=1, batch_id='some_batch_id')
result = level1.update_prc_status(level1_id='some_level1_id', data_type='SCI', prc_status=1, batch_id='some_batch_id')
print(result)
```
......@@ -115,7 +115,7 @@ from csst_dfs_client import level1
local_file_path = '/path/to/your/level1_data.fits'
module_id = 'MSC'
level1_id = 'some_level1_id'
file_type = 'SCI'
data_type = 'SCI'
file_name = 'level1_data.fits'
dag_id = 'some_dag_id'
pmapname = 'some_pmapname'
......@@ -125,7 +125,7 @@ dataset = 'default_dataset'
batch_id = 'default_batch_id'
qc1_status = 0
result = level1.write(local_file_path, module_id, level1_id, file_type, file_name, dag_id, pmapname, build, level0_id, dataset, batch_id, qc1_status)
result = level1.write(local_file_path, module_id, level1_id, data_type, file_name, dag_id, pmapname, build, level0_id, dataset, batch_id, qc1_status)
print(result)
```
......
......@@ -24,12 +24,12 @@ class Level1TestCase(unittest.TestCase):
self.assertIsNotNone(result.data, "error message: " + result.message)
def test_update_qc1_status(self):
result = level1.update_qc1_status(level1_id = "1060940003452925", file_type='SCI', qc1_status=1)
result = level1.update_qc1_status(level1_id = "1060940003452925", data_type='csst-msc-l1-mbi', qc1_status=1)
print(result)
self.assertEqual(result.code, 200, "error code: " + str(result.code) + ", message: " + result.message)
def test_update_prc_status(self):
result = level1.update_prc_status(level1_id = "1060940003452925", file_type='SCI', prc_status=3)
result = level1.update_prc_status(level1_id = "1060940003452925", data_type='csst-msc-l1-mbi', prc_status=3)
print(result)
self.assertEqual(result.code, 200, "error code: " + str(result.code) + ", message: " + result.message)
......@@ -46,7 +46,7 @@ class Level1TestCase(unittest.TestCase):
dag_id = "csst-msc-l1-mbi",
file_name= "CSST_MSC_MS_SCI_20240609181116_20240609181347_10109100157991_27_L1_V01.fits",
pmapname="csst_000128.pmap",
file_type='SCI',
data_type='csst-msc-l1-mbi',
build=1,
qc1_status=10,
prc_status=12)
......
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