Commit 7992adb4 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

tweaks

parent 8011a52f
Loading
Loading
Loading
Loading

csst_dag/msc/__init__.py

deleted100644 → 0
+0 −35
Original line number Diff line number Diff line
SLS_CHIPID = [
    "01",
    "02",
    "03",
    "04",
    "05",
    "10",
    "21",
    "26",
    "27",
    "28",
    "29",
    "30",
]

MBI_CHIPID = [
    "06",
    "07",
    "08",
    "09",
    "11",
    "12",
    "13",
    "14",
    "15",
    "16",
    "17",
    "18",
    "19",
    "20",
    "22",
    "23",
    "24",
    "25",
]

gen_msg.py

0 → 100644
+36 −0
Original line number Diff line number Diff line
import json
from astropy import time
import numpy as np


def gen_dag_runid(digits=10):
    now = time.Time.now()
    dagrunid = now.iso[:10].replace("-", "")
    for i in range(digits):
        dagrunid += f"{np.random.randint(low=0, high=9)}"
    return dagrunid


def gen_msg(dag_id="csst-msc-l1-mbi", obsid="11009101682009", chipid="09"):

    data = {
        "dag_id": dag_id,
        "dag_run_id": gen_dag_runid(),
        "message": {
            "obsid": obsid,
            "chipid": chipid,
        },
    }
    msg = json.dumps(data, ensure_ascii=False, indent=None)
    print(f"http://localhost:3000/scalebox/run/level0?id={data['dag_run_id']}")
    # msg = msg.replace('"', '\\"')
    return msg


gen_msg()
# def gen_cmd(dag_id="csst-msc-l1-mbi", obsid="11009101682009", chipid="09"):
#     msg = gen_msg(dag_id=dag_id, obsid=obsid, chipid=chipid)
#     print()


# http://localhost:3000/scalebox/run/level0?id=202411286117850576