Simple remote monitoring for applications and batch jobs
remstat makes it easy to check on the status of applications and data processing jobs from anywhere. Please note that it is still a work-in-progress and you should not use it for critical tasks at this time.
from math import sin, pi
from time import sleep
from requests import post
stream = "sine-wave"
for n in range(0, 10):
# Do something that takes a while.
sleep(5)
# Update your remstat stream.
post(
f"https://remstat.us/api/streams/{stream}/messages",
params={
"comment": "bar" if n % 2 else "foo",
"value": sin(3*pi*n/9)
},
headers={"Authorization": "<your-api-key>",}
).raise_for_status()
(async () => {
const stream = "sine-wave"
for (const n of Array(10).keys()) {
// Do something that takes a while.
await new Promise((r) => setTimeout(r, 5000));
// Update your remstat stream.
await fetch(
`https://remstat.us/api/streams/${stream}/messages?` +
`comment=${n % 2 ? "bar" : "foo"}&` +
`value=${Math.sin((3 * Math.PI * n) / 9)}`,
{
method: "POST",
headers: {
Authorization: "<your-api-key>",
},
}
).then(console.log, console.error);
}
})();
import tensorflow as tf
import numpy as np
import requests
stream = "train-addition-model"
def remstat(epoch, logs):
requests.post(f"https://remstat.us/api/streams/{stream}/messages",
params={
**logs,
"epoch": epoch,
},
headers={"Authorization": "your-api-key"}
).raise_for_status()
remstat_callback = tf.keras.callbacks.LambdaCallback(on_epoch_end=remstat)
X = np.random.uniform(0, 10, size=(10000, 2))
y = np.sum(X, axis=1, keepdims=True)
model = tf.keras.Sequential([
tf.keras.layers.Input((2)),
tf.keras.layers.Dense(1)
])
model.compile(loss="mse")
model.fit(
X[:5000],
y[:5000],
epochs=100,
validation_data=(X[5000:], y[5000:]),
callbacks=[remstat_callback]
)