Created
June 14, 2012 18:38
-
-
Save andre-merzky/2932058 to your computer and use it in GitHub Desktop.
Basic TROY example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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