X Tutup
Skip to content
This repository was archived by the owner on Feb 1, 2026. It is now read-only.

Minimum Viable Product of Python Programmatic Model Run#1

Merged
amc1999 merged 1 commit intoopenmpp:masterfrom
scottyunho:master
Nov 6, 2024
Merged

Minimum Viable Product of Python Programmatic Model Run#1
amc1999 merged 1 commit intoopenmpp:masterfrom
scottyunho:master

Conversation

@scottyunho
Copy link
Contributor

The bare bones of a potential Python integration of OpenM++.

API calls and other functions are done through the Functions folder, with "Create.py" generating new information on the server-side, "Delete.py" deleting information on the server-side, "Get.py" pulling existing information on the server-side, "Load.py" pulling information about a specific model on the server-side, and "Utilities.py" providing helper functions. Note that many functions aren't complete yet.

The file "PyOpenMPP_main.py" provides a demo for how to call these functions to work with OpenM++. The file "PohemX-python.py" does the same but as a standalone file with all the functions defined inside of itself (separate since this doesn't seem like best practice to do it all from one file).

The bare bones of documentation for the new code is in the "README_2.md" file.

Please advise on whether my current code structure is okay, or if I should change how I go about developing this in the future.

… output tables as CSV/Excel format) for Python implementation.
@amc1999
Copy link
Member

amc1999 commented Nov 6, 2024

Accepted, thank you.

  1. Please move Python mains into sub-folder, e.g. ModelRun or py-main or any other name of your choice. I assume it would be more than one Python utility here.

  2. It may be better to shutdown oms by curl -v -X PUT http://localhost:4040/shutdown on Linux / MacOS or use kill.

Please see example of shutdown at https://github.com/openmpp/openmpp.github.io/wiki/Oms-API-PUT-shutdown-service or even better at models/stop-model-ui-linux.sh. Also there is a kill example at https://github.com/openmpp/other/blob/master/azure_cloud/oms/omsd-start.sh and omsd-stop.sh

It is also possible to start oms on available port instead of hard coded 4040. Scripts in models directory doing exactly that. Oms can save it own URL into file where stop-model-ui-linux.sh can find it later.

I am thinking to add another option into oms to save pid into file, similar to current option which save url into file. Feel free to do it, if you have a time to play with Go.

  1. I understand model run function is at very early stage now, you will probably going to add more options into that. Model run API call documented at: https://github.com/openmpp/openmpp.github.io/wiki/Oms-API-POST-run-the-model

I am keeping Opts OpenM.Threads for backward compatibility only, it should work, however, it would be nice to use Threads integer in the new development, example from wiki:

{
  "ModelName": "RiskPaths",
  "Opts": {
    "OpenM.SubValues": "16"
  },
  "Threads": 4,
  "Mpi": {
    "Np": 2
  },
  "Template": "mpiSmallCluster.template.txt"
}

@amc1999 amc1999 merged commit 63d016c into openmpp:master Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup