class BaseMessage(Struct): # needs default as json.py seems to get inheritance wrong req = Field(str, '?') time = Field(float, default = time.time) hostname = Field(str, default = socket.gethostname()) blob_hash = Field(str, default = '')
class LogtailMessage (BaseMessage): req = Field(str, "pub.logtail") filename = Field(str) data = Field(str) # file contents (data fork) comp = Field(str) # compression method used mode = Field(str, 'b') # file mode to use for fopen fpos = Field(int) op_mode = Field(str) # classic, rotated st_dev = Field(long) # device number st_ino = Field(int) # inode number
class LogMessage(BaseMessage): "log.*" log_level = Field(str) service_type = Field(str) job_name = Field(str) log_msg = Field(str) log_time = Field(float) log_pid = Field(int) log_line = Field(int) log_function = Field(str)
class InfofileMessage(BaseMessage): req = Field(str, "pub.infofile") mtime = Field(float) # last modification time of file filename = Field(str) data = Field(str) # file contents (data fork) comp = Field(str) # compression method used mode = Field(str, 'b') # file mode to use for fopen
class TaskReplyMessage (BaseMessage): req = Field(str, "task.reply") task_id = Field(str) status = Field(str) # launched, feedback, finished, failed, running, stopped
class TaskSendMessage(BaseMessage): """Request to execute a task""" req = Field(str, "task.send") task_host = Field(str) task_handler = Field(str) task_id = Field(str)
class TaskRegisterMessage(BaseMessage): req = Field(str, "task.register") host = Field(str)
class JobConfigReplyMessage(BaseMessage): req = Field(str, "job.config") job_name = Field(str) config = Field(dict)
class JobConfigRequestMessage(BaseMessage): req = Field(str, "job.config") job_name = Field(str)
class DatabaseMessage (BaseMessage): req = Field (str, "db") function = Field (str) params = Field (str)
class EchoResponseMessage (BaseMessage): req = Field(str, "echo.response") orig_hostname = Field(str) orig_target = Field(str) orig_time = Field(float)
class EchoRequestMessage (BaseMessage): req = Field(str, "echo.request") target = Field(str)
class ErrorMessage (ReplyMessage): req = Field(str, "error") msg = Field(str)
class ReplyMessage (BaseMessage): req = Field(str, "reply")