Lexset has a python package available that can be used to interact with our RESTful API
You can install the python package with a simple pip install. The most recent version is 3.5.0
please be sure you have the most recent version.
The python package will create a class for each simulation you start. You can use that class to keep track of your data and your simulation's progress.
It is also possible to use the python API without creating a class for a simulation. This is necessary if you have already started the simulation via the GUI. You can download, start and stop simulations as well as list all active simulations this way.
If a simulation is already running or "active" you can use the class activateSimulation
to easily manage the data associated with your simulation.
Once you have created your simulation you then need to send your config to Lexset and create a simulation that you can run on our servers.
This will send the config to our severs and return your user ID, simulation ID and Dataset ID so that you can work with your data as well as start and stop your simulation.
Once you have created a simulation you can then start the simulation and begin collecting data.
Please note that your simulation will first be added to the simulation queue and will be started as soon as resources are available in your account. For more information on the queue please refer to the documentation for the simulation manager.
If you create a simulation through the GUI you can start it with the following command.
If your simulation is currently in the queue, you can remove it from the queue and place it in a ready state as follows. Please refer to the simulation manager documentation for more information on simulation states.
If a simulation is complex it might take a long time to run and it may be necessary to check the status periodically.
You can also use getProgress() to print how much of the dataset has been generated as a percentage.
Once you have run this function you can check to see if it is complete or still running.
Once your simulation is running and generating data you can check all the datapoints and preview images. To get a full list of all the data generated so far you can use the following.
That will return a list of dataset items rendered so far
You can access the dataset items with this
You can also get your progress with the following function.
In some situations you might want to stop a simulation early.
If you create a simulation through our GUI you can stop with the following command.
You can also add relationships and colormaps via our API.
If you are running multiple simulations it may be necessary for you get a list of all the simulations.
If you created your simulation using the GUI you can access a list of simulations as follows.
Once your simulation is complete, or after you have forced it to stop, you can download the dataset. You can get an archive to download with the following.
It is also possible to download data directly by acquiring your dataset id. You can capture the Dataset id with the getDatasetID()
function.
Example:
If you have an enterprise account you will want to track resources being used across all user accounts. You can get the total number of active nodes with the following command.
Return a list of all simulations created across your organization (enterprise accounts only)
Possible States:
RUNNING- a list of all running simulations
COMPLETED - a list of completed simulations
CREATED- a list of created simulations
QUEUED - a list of all simulations currently in the queue
This endpoint requires an organization id. Your organization ID is available on your account page.
This operation is designed for large datasets. The operation will break your zip archive into multiple parts and download each on a separate thread. You can define the number of threads you want to use with the "workers" argument.
You can also delete a simulation using the API through the delete simulation endpoint.
End to end demonstration of how to create, run and download simulation results using the Lexset management API.