This page is intended to provide specific information for Musicode users of MuPIF platform.
$ pyro5-nsc -n 172.22.2.1 -p 10000 ping Name server ping ok.
1. 1. 2022
9. 2. 2022
18. 5. 2022
Assuming we have a properly implemented model class named 'ClassnameOfModel', which is derived from mupif.Model and is implemented in file 'model_example.py', we can make it accessible from the Musicode VPN network with the following script. First we import mupif and the model class
import mupif as mp from model_example import ClassnameOfModel
Then we locate the nameserver with
ns = mp.pyroutil.connectNameServer(nshost='172.22.2.1', nsport=10000)
Then the script contains a code, which creates a jobmanager instance with given parameters, runs it and registers it on the nameserver. The maxJobs is an optional parameter specifying how many remote model instances can exist at the same time.
mp.SimpleJobManager( ns=ns, appClass=ClassnameOfModel, appName='Mupif.JobManager@model_name', jobManWorkDir='directory_path', maxJobs=5 ).runServer()
After this script is executed, the jobmanager can be obtained from the nameserver by its name 'Mupif.JobManager@model_name'. With the jobmanager we can remotely instantiate a new instance of our model class. For more information look at the https://github.com/mupif/mupif/blob/Musicode/examples/Example13/server.py or other examples.
An existing jobmanager “CVUT.demo01” for model from mupif Example13 (https://github.com/mupif/mupif/tree/Musicode/examples/Example13) is running and is registered at the project nameserver, which can be seen in the monitor at http://mupif.org/musicode/. To run the workflow in https://github.com/mupif/mupif/blob/Musicode/examples/Example13/main.py, which interacts with the this existing jobmanager, run the following command in the Example13 directory:
MUPIF_NS=172.22.2.1:10000 python3 main.py
It asks the given nameserver for the jobmanager named “CVUT.demo01”, which provides a new instance of the model, which it then used for the calculation.