import saliweb.backend

class Job(saliweb.backend.Job):
    runnercls = saliweb.backend.SGERunner

    def run(self):
        libs = {'PoseScore': 'protein_ligand_pose_score.lib',
                'RankScore': 'protein_ligand_rank_score.lib'}
        pdb, mol2, lib = open('input.txt').readline().strip().split(' ')
        lib = libs[lib]
        script = """
module load imp
lib=`python -c "import IMP.atom; print IMP.atom.get_data_path('%s')"`
ligand_score %s %s "$lib" > score.list 2> score.log
""" % (lib, mol2, pdb)
        r = self.runnercls(script)
        r.set_sge_options('-l arch=linux-x64')
        return r

def get_web_service(config_file):
    db = saliweb.backend.Database(Job)
    config = saliweb.backend.Config(config_file)
    return saliweb.backend.WebService(config, db)


import saliweb.backend

class Job(saliweb.backend.Job):
    runnercls = saliweb.backend.WyntonSGERunner

    def run(self):
        libs = {'PoseScore': 'protein_ligand_pose_score.lib',
                'RankScore': 'protein_ligand_rank_score.lib'}
        pdb, mol2, lib = open('input.txt').readline().strip().split(' ')
        lib = libs[lib]
        script = """
module load Sali
module load imp
lib=`python -c "import IMP.atom; print IMP.atom.get_data_path('%s')"`
ligand_score %s %s "$lib" > score.list 2> score.log
""" % (lib, mol2, pdb)
        r = self.runnercls(script)
        r.set_sge_options('-l arch=lx-amd64')
        return r

def get_web_service(config_file):
    db = saliweb.backend.Database(Job)
    config = saliweb.backend.Config(config_file)
    return saliweb.backend.WebService(config, db)


Switch to new Wynton cluster
Switch to new Wynton cluster

  import saliweb.backend
  
  class Job(saliweb.backend.Job):
-     runnercls = saliweb.backend.SGERunner
+     runnercls = saliweb.backend.WyntonSGERunner
  
      def run(self):
          libs = {'PoseScore': 'protein_ligand_pose_score.lib',
                  'RankScore': 'protein_ligand_rank_score.lib'}
          pdb, mol2, lib = open('input.txt').readline().strip().split(' ')
          lib = libs[lib]
          script = """
+ module load Sali
  module load imp
  lib=`python -c "import IMP.atom; print IMP.atom.get_data_path('%s')"`
  ligand_score %s %s "$lib" > score.list 2> score.log
  """ % (lib, mol2, pdb)
          r = self.runnercls(script)
-         r.set_sge_options('-l arch=linux-x64')
+         r.set_sge_options('-l arch=lx-amd64')
          return r
  
  def get_web_service(config_file):
      db = saliweb.backend.Database(Job)
      config = saliweb.backend.Config(config_file)
      return saliweb.backend.WebService(config, db)
  
  
Switch to new Wynton cluster
## Code Before:
import saliweb.backend

class Job(saliweb.backend.Job):
    runnercls = saliweb.backend.SGERunner

    def run(self):
        libs = {'PoseScore': 'protein_ligand_pose_score.lib',
                'RankScore': 'protein_ligand_rank_score.lib'}
        pdb, mol2, lib = open('input.txt').readline().strip().split(' ')
        lib = libs[lib]
        script = """
module load imp
lib=`python -c "import IMP.atom; print IMP.atom.get_data_path('%s')"`
ligand_score %s %s "$lib" > score.list 2> score.log
""" % (lib, mol2, pdb)
        r = self.runnercls(script)
        r.set_sge_options('-l arch=linux-x64')
        return r

def get_web_service(config_file):
    db = saliweb.backend.Database(Job)
    config = saliweb.backend.Config(config_file)
    return saliweb.backend.WebService(config, db)


## Instruction:
Switch to new Wynton cluster
## Code After:
import saliweb.backend

class Job(saliweb.backend.Job):
    runnercls = saliweb.backend.WyntonSGERunner

    def run(self):
        libs = {'PoseScore': 'protein_ligand_pose_score.lib',
                'RankScore': 'protein_ligand_rank_score.lib'}
        pdb, mol2, lib = open('input.txt').readline().strip().split(' ')
        lib = libs[lib]
        script = """
module load Sali
module load imp
lib=`python -c "import IMP.atom; print IMP.atom.get_data_path('%s')"`
ligand_score %s %s "$lib" > score.list 2> score.log
""" % (lib, mol2, pdb)
        r = self.runnercls(script)
        r.set_sge_options('-l arch=lx-amd64')
        return r

def get_web_service(config_file):
    db = saliweb.backend.Database(Job)
    config = saliweb.backend.Config(config_file)
    return saliweb.backend.WebService(config, db)

