runs

Messages

Starting from version v2.1.0, it is possible to send messages from the user interface which can be captured in real-time in your Python code. You can retrieve the message within a context using run.message(key).

with run.message("save-model") as msg:
    if not msg.content:
        # skip execution 
        msg.skip()
    model.save()
    # Once this context is exited, the message is acknowledged and you'll not 
    # enter the context again

The object msg has two public attributes :

  • msg.content: A string value of the message at the given key. If the value was left empty in the UI, then the default value is 1. It takes the value None when there is no message for the given key.
  • msg.skip: A method to skip the execution of the context without raising an error. It is important to include the msg.skip() statement to prevent from executing the context when there is no message.

Include this snippet of code in your training loop to execute blocks on-demand.