Skip to content

Instantly share code, notes, and snippets.

@andre-merzky
Created June 14, 2012 18:38
Show Gist options
  • Save andre-merzky/2932058 to your computer and use it in GitHub Desktop.
Save andre-merzky/2932058 to your computer and use it in GitHub Desktop.
Basic TROY example
#!/usr/bin/python
import troy
def main () :
try:
cpd = troy.pilot.ComputePilotDescription ()
cpd['queue'] = 'large'
cps = troy.pilot.ComputePilotService ()
print "cps : " + str (cps)
print cps.list_pilots ()
cp1 = cps.create_pilot ("diane://cluster_1.net/", cpd)
cp2 = cps.create_pilot ("diane://cluster_2.net/", cpd)
print str(cps.list_pilots ())
cus = troy.pilot.ComputeUnitService ()
cus.add_compute_pilot_service (cps)
print str (cus.list_compute_pilot_services ())
cud = troy.pilot.ComputeUnitDescription ()
cud['executable'] = 'touch'
cud['arguments'] = ['/tmp/hello_troy', '&&', 'sleep', '10']
cu = cus.submit_compute_unit (cud)
cu.wait ()
cp1.cancel ()
cp2.cancel ()
except Exception, e:
print str (e)
if __name__ == "__main__":
main ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment