Javadoc link

The Runtime is the first Service to start when MyRobotLab begins.  Every running instance of MyRobotLab includes a single Runtime Service.  The Runtime is a singleton, which means there should be only one per running process of MyRobotLab.  Its responsibilities include the creation, removal, and merging of Services into the Service registry.

The registry is critical for routing communication between Services.

In addition to managing the endpoints of Service communication the Runtime can retrieve information regarding details of the Java VM, operating system, and other details.

 

Example code (from branch develop):
#file : Runtime.py (github)
#########################################
# Runtime.py
# description: Runtime starts stops saves all other services
# categories: system
# more info @: http://myrobotlab.org/service/Runtime
#########################################
 
# prints the days hours minutes your MRL has been alive
print runtime.getUptime()
 
# print the id of your instance of mrl
print ("my mrl version is {}".format(runtime.getVersion()))
print ("myrobotlab id is {}".format(runtime.getId()))
print ("computer {}".format(runtime.getHostname()))
print ("process id {}".format(runtime.getPid()))
 
# learn about your system
print ("{} processors".format(runtime.availableProcessors()))
print ("{} Gb free memory".format(runtime.getFreeMemory()/100000000))
print ("{} Gb total memory".format(runtime.getTotalMemory()/100000000))
 
# start a single service
clock = runtime.start('clock', 'Clock')
clock.startClock()
sleep(3)
 
# release the service
runtime.release('clock')
 
# get list of currently running services
services = runtime.getServices()
print ("list my {} currently running services".format(len(services)))
for service in services:
  print (service.getName())
 
# save the current state of the system into a config set
# located data/config/my-config
runtime.saveConfig('my-config')
 
# start that config set up
runtime.startConfig('my-config')
 
# release that config
# runtime.releaseConfig('my-config')
 
# create and start an Arduino service
runtime.start("arduino", "Arduino")
 
print(runtime.getHostname())
print(runtime.getPid())
 
# To execute a program from the Operating System (OS)
# Note: this is blocking, that is the program must finish before control returns to MRL
# runtime.exec("c:/notepad.exe")
# runtime.shutdown(10)
Example configuration (from branch develop):
#file : Runtime.py (github)
!!org.myrobotlab.service.config.RuntimeConfig
enableCli: true
locale: null
logLevel: null
peers: null
registry: [
  ]
type: Runtime
virtual: null