User Tools

Site Tools


musicode:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
musicode:start [2021/12/08 13:43] – added info on musicode branch bpmusicode:start [2023/12/07 02:06] (current) – [Setting up Model Server] stanislavsulc
Line 21: Line 21:
  
 ==== MuPIF Services ==== ==== MuPIF Services ====
-  * Platform online monitor  http://mupif.org/musicode/ +  * Platform online monitor http://mupif.org/musicode/ 
 +  * Model API generator https://mupif.org/tools/api_generator.html 
 + 
 +==== Changelog of Important MuPIF updates (in chronological order) === 
 + 
 +1. 1. 2022 
 +  * Instead of PropertyID, FieldID, ParticleSetID, MiscID use only DataID, which contains all enum members 
 +  * meatadata Inputs contain key "Set_at": {"type": "string", "enum": ["initialization", "timestep"]}, which defines whether it should be set before each timestep or only once at the initialization. 
 +  * In initialize() function the argument "file" was removed. New methodology of setting input file using set() function and mupif.PyroFile, see https://github.com/mupif/mupif/blob/Musicode/examples/Example07-stacTM-JobMan-distrib/Example07.py. 
 +  * Only generalized set() and get() functions can be used. Functions setProperty, getProperty, setField, getField, etc. are no longer supported. 
 + 
 +9. 2. 2022 
 +  * Obj_ID in Inputs/Outputs metadata must be of type string. 
 +  * For Type mupif.Property in Inputs/Outputs metadata the "ValueType" must be specified. Choose from following values: ["Scalar", "Vector", "Tensor"
 + 
 +18. 5. 2022 
 +  * The workflow metadata contain item "Models" to describe the instantiation of the contained models. (jobmanager name for remote model and module name with class name for local model) See MuPIF examples. The models are instantiated automatically by the workflow, so there is no need to implement it in the initialize method. 
 +  * The default value of metadata argument in the initialize function was changed to None. 
 + 
 +==== Setting up Model Server ==== 
 + 
 +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 
 +<code> 
 +import mupif as mp 
 +from model_example import ClassnameOfModel 
 +</code> 
 +Then we locate the nameserver with 
 +<code> 
 +ns = mp.pyroutil.connectNameServer(nshost='172.22.2.1', nsport=10000) 
 +</code> 
 +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. 
 +<code> 
 +mp.SimpleJobManager( 
 +    ns=ns, 
 +    appClass=ClassnameOfModel, 
 +    appName='InstitutionName.ModelName', 
 +    jobManWorkDir='directory_path', 
 +    maxJobs=5 
 +).runServer() 
 +</code> 
 +After this script is executed, the jobmanager can be obtained from the nameserver by its name 'InstitutionName.ModelName'. 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. 
 + 
 + 
 +==== Interaction with test jobmanager ==== 
 + 
 +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: 
 +<code> 
 +MUPIF_NS=172.22.2.1:10000 python3 main.py 
 +</code> 
 +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. 
 + 
 +==== Getting help ==== 
 + 
 +  * The preferred way to get support from CVUT Team is to create a new ticket on GitHub (https://github.com/mupif/mupif/issues). This way you can track progress of your issue and get support quckly. 
musicode/start.1638967387.txt.gz · Last modified: 2021/12/08 13:43 by bp