Changeset 3579
- Timestamp:
- 10/26/2009 02:01:23 PM (1 month ago)
- Files:
-
- gip/trunk/gip/lib/python/gip/batch_systems/batch_system.py (modified) (1 diff)
- gip/trunk/gip/lib/python/gip/batch_systems/pbs.py (modified) (2 diffs)
- gip/trunk/gip/lib/python/gip/batch_systems/sge.py (modified) (1 diff)
- gip/trunk/gip/lib/python/gip/providers/generic_batch_system.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gip/trunk/gip/lib/python/gip/batch_systems/batch_system.py
r3541 r3579 107 107 """ 108 108 109 def bootstrap(self): 110 """ 111 This function is called before any others; this is the proper time to 112 do any environment or batch system initialization. 113 """ 114 gip/trunk/gip/lib/python/gip/batch_systems/pbs.py
r3543 r3579 9 9 import gip_sets as sets 10 10 11 from gip_common import HMSToMin, getLogger, VoMapper, voList, parseRvf 11 from gip_common import HMSToMin, getLogger, VoMapper, voList, parseRvf, \ 12 addToPath 12 13 from gip_testing import runCommand 13 14 from gip.batch_systems.batch_system import BatchSystem … … 418 419 return vos 419 420 421 def bootstrap(self): 422 try: 423 pbs_path = cp_get(self.cp, "pbs", "pbs_path", ".") 424 addToPath(pbs_path) 425 # adding pbs_path/bin to the path as well, since pbs/torque home 426 # points to /usr/local and the binaries exist in /usr/local/bin 427 addToPath(pbs_path + "/bin") 428 except Exception, e: 429 log.exception(e) 430 431 gip/trunk/gip/lib/python/gip/batch_systems/sge.py
r3571 r3579 430 430 return results 431 431 432 def bootstrap(self): 433 """ 434 If it exists, source 435 $SGE_ROOT/$SGE_CELL/common/settings.sh 436 """ 437 sge_root = cp_get(cp, "sge", "sge_root", "") 438 if not sge_root: 439 log.warning("Could not locate sge_root in config file! Not " \ 440 "bootstrapping SGE environment.") 441 return 442 sge_cell = cp_get(cp, "sge", "sge_cell", "") 443 if not sge_cell: 444 log.warning("Could not locate sge_cell in config file! Not " \ 445 "bootstrapping SGE environment.") 446 return 447 settings = os.path.join(sge_root, sge_cell, "common/settings.sh") 448 if not os.path.exists(settings): 449 log.warning("Could not find the SGE settings file; looked in %s" % \ 450 settings) 451 return 452 cmd = "/bin/sh -c 'source %s; /usr/bin/env'" % settings 453 fd = os.popen(cmd) 454 results = fd.read() 455 if fd.close(): 456 log.warning("Unable to source the SGE settings file; tried %s." % \ 457 settings) 458 for line in results.splitlines(): 459 line = line.strip() 460 info = line.split('=', 2) 461 if len(info) != 2: 462 continue 463 os.environ[info[0]] = info[1] 464 gip/trunk/gip/lib/python/gip/providers/generic_batch_system.py
r3561 r3579 191 191 log.error("Unknown job manager: %s" % impl) 192 192 sys.exit(1) 193 batch.bootstrap() 193 194 queueInfo, totalCpu, freeCpu, queueCpus = print_CE(batch) 194 195 print_VOViewLocal(queueInfo, batch)
