def _writeSubmitScript(self): """mostly to be able to source .qsubrc on linux or qsubrc.bat on windows""" if sys.platform.startswith('win'): scriptPath = path.join(self.folder, 'submit.bat' ) qsubRc = path.expandvars( path.join("$HOME","qsubrc.bat") ) cmdL = ["@ECHO off"] if path.exists(qsubRc): cmdL.append('call "%s"'%qsubRc) # didn't actually tried if this feature works :p cmdL.append('"%s" "%s"'%( sys.executable, launcherPath ) ) else: scriptPath = path.join( self.folder, 'submit.sh' ) qsubRc = path.expandvars( path.join("$HOME",".qsubrc") ) cmdL = ["#!/usr/bin/env bash"] if path.exists(qsubRc): cmdL.append('source "%s"'%qsubRc) cmdL.append('"%s" "%s"'%( sys.executable, launcherPath ) ) writeFile( '\n'.join( cmdL ), scriptPath ) os.chmod(scriptPath, 0o755) return scriptPath
def writeCmd(self, cmd ): cmdPath = path.join( self.folder, 'run' ) writeFile( cmd, cmdPath ) os.chmod( cmdPath, 0o755 )