Hi all,
I wanted to try writing a function which sends a set of tasks to the system monitor on my locally running version of Juice. I have a mock_warmup function which just increases the temperature of some thermometers.
This was my implementation of the task sending based on the documentation:
from pydantic import computed_field
from orangeqs.juice.schemas.tasks import IPythonTask
from orangeqs.juice import Client
class SetInterval(IPythonTask):
interval: str
@computed_field
@property
def code(self) -> str:
return f"system_monitor.config.report_interval = {interval}"
class Warmup(IPythonTask):
targets: dict
duration: int
wait_duration: int
@computed_field
@property
def code(self) -> str:
return f"await system_monitor.thermometers.mock_thermometers.mock_warmup(system_monitor.thermometry, targets = {targets}, duration={duration}, wait_duration = {wait_duration}, interval=system_monitor.config.report_interval)"
async def start_warmup(targets, duration, wait_duration, interval):
client = Client()
payload1 = SetInterval(interval)
payload2 = Warmup(targets, duration, wait_duration)
result = await client.execute(“system-monitor”, payload1)
result = await client.execute(“system-monitor”, payload2)
return True
and then I am calling from my device/single user kernel:
targets = {
"thermometer_5": 0.25,
"thermometer_4": 1,
"thermometer_3": 3,
}
f.start_warmup(targets, duration = 10, wait_duration = 10, interval = 1)
This should send two tasks to my system monitor I believe. One to decrease the report interval (just so my temperature updates more often in my influxdb), and one task with my custom warmup function. These functions work if I run them directly on a system-monitor kernel.
The only output I get is <coroutine object start_warmup at 0x7637919298b0>.
Any advice?