-
Notifications
You must be signed in to change notification settings - Fork 26
Application control
[[module omega]]
Last revision: ver. 4.2-alpha3 - 21 August 2013
These functions control execution and can be used to start stop and clean scripts, and to execute deferred code.
Exits the application
Returns True
if the script is executing on the master node of a cluster display system.
Queues a script command for execution. The command will be executed during the next update cycle.
For cluster systems only. When executed on the master node, it tells all the slaves (and itself) to execute the specified command. Useful to implement event handlers after some code executed only on the master node (i.e. caching of remote data).
A broadcastCommand
call executed on a slave node does nothing. A call on a non-cluster environment behaves like queueCommand
.
Example:
import urllib
# On the master node, fetch an image somewhere on the internet
if(isMaster())
urllib.urlretrieve("http://www.digimouth.com/news/media/2011/09/google-logo.jpg", "local-image.jpg")
# Call this when you are done
broadcastCommand('onImageLoaded()')
# This will be called on all nodes once the image is loaded. You can open the image here.
# (Assuming use of a shared filesystem in your cluster installation)
def onImageLoaded():
img = loadImage("local-image.jpg")
Runs an external script. The script is executed immediately. The script path accepts two macros:
-
OMEGA_DATA_ROOT
will be substituted with the default data directory for the omegalib installation -
OMEGA_APP_ROOT
will be substituted with the application directory for the installation (set throguh CMake at build configuration time)
Stops the current script, cleans the engine and get everything back to its initial state.
Like orun, but performs a cleanup first. Useful for runtime switching to a different application.
Returns a MissionControlClient instance if this application is running a mission control client. Returns None otherwise. Applications can start a mission control client when launched with the --mc client
or --mc @host:port
options specified. See the and CommandLine pages for more information.
Gets the name of the host running the slave instance of omegalib
Returns true if the specified host owns at least a tile in the specified tile rectangle. Example:
# Prints TRUE on hosts that are within the tile rectangle [1,1 -> 2,1]
if(isHostInTileSection(getHostname(), 1, 1, 2, 1) print('TRUE')
Enables or disables rendering for the specified tile region. Tiles need to be part of a tile grid to be controllable with this function.
TODO