Skip to content

Commit

Permalink
Drop runners for decommissioned SGE clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Sep 4, 2020
1 parent c476a20 commit 89ce87b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 44 deletions.
3 changes: 0 additions & 3 deletions doc/modules/backend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ The :mod:`saliweb.backend` Python module
.. autoclass:: SGERunner
:members:

.. autoclass:: SaliSGERunner
:members:

.. autoclass:: WyntonSGERunner
:members:

Expand Down
43 changes: 9 additions & 34 deletions python/saliweb/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1581,15 +1581,17 @@ def remove(self, key):

class Runner(object):
"""Base class for runners, which handle the actual running of a job,
usually on an SGE cluster (see the :class:`SGERunner` and
:class:`SaliSGERunner` subclasses). To create a subclass, you must
implement both a _run method and a _check_completed class method,
set the _runner_name attribute to a unique name for this class,
and call :meth:`Job.register_runner_class` passing this class."""
usually on an SGE cluster (see the :class:`WyntonSGERunner` subclass).
To create a subclass, you must implement both a _run method and
a _check_completed class method, set the _runner_name attribute to a
unique name for this class, and call :meth:`Job.register_runner_class`
passing this class."""


class SGERunner(Runner):
"""Run a set of commands on the QB3 SGE cluster.
"""Base class to run a set of commands on an SGE cluster.
Use a subclass specific to the cluster you want to use, such
as :class:`WyntonSGERunner`.
To use, pass a string `script` containing a set of commands to run,
and use `interpreter` to specify the shell (e.g. `/bin/sh`, `/bin/csh`)
Expand All @@ -1606,18 +1608,6 @@ class SGERunner(Runner):
options and/or :meth:`set_sge_name` to set the SGE job name.
"""

_runner_name = 'qb3ogs'
_drmaa = None
_env = {'SGE_CELL': 'qb3cell',
'SGE_ROOT': '/usr/local/sge',
'SGE_QMASTER_PORT': '6444',
'SGE_EXECD_PORT': '6445',
'DRMAA_LIBRARY_PATH':
'/usr/local/sge/lib/linux-x64/libdrmaa.so.1.0'}
_qstat = '/usr/local/sge/bin/linux-x64/qstat'

_waited_jobs = _LockedJobDict()

def __init__(self, script, interpreter='/bin/sh'):
Runner.__init__(self)
self._opts = ''
Expand Down Expand Up @@ -1741,25 +1731,10 @@ def _check_bulk_completed(cls, jobid):
return True
else:
raise OSError("qstat returned %d (%s)" % (ret, "\n".join(out)))
Job.register_runner_class(SGERunner)


class SaliSGERunner(SGERunner):
"""Run commands on the Sali SGE cluster instead of the QB3 cluster."""
_runner_name = 'salisge'
_drmaa = None
_env = {'SGE_CELL': 'sali',
'SGE_ROOT': '/home/sge61',
'DRMAA_LIBRARY_PATH':
'/home/sge61/lib/lx24-amd64/libdrmaa.so.1.0'}
_qstat = '/home/sge61/bin/lx24-amd64/qstat'

_waited_jobs = _LockedJobDict()
Job.register_runner_class(SaliSGERunner)


class WyntonSGERunner(SGERunner):
"""Run commands on the Wynton SGE cluster instead of the QB3 cluster."""
"""Run commands on the Wynton SGE cluster"""
_runner_name = 'wyntonsge'
_drmaa = None
_env = {'SGE_CELL': 'wynton',
Expand Down
2 changes: 1 addition & 1 deletion test/backend/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def make_test_jobs(sql):
utcnow + datetime.timedelta(days=1), '/', 'http://testurl'))
c.execute("INSERT INTO jobs(name,state,runner_id,submit_time, " \
+ "expire_time,directory,url) VALUES(?,?,?,?,?,?,?)",
('job2', 'RUNNING', 'salisge:job-2',
('job2', 'RUNNING', 'wyntonsge:job-2',
utcnow + datetime.timedelta(hours=1),
utcnow + datetime.timedelta(days=1), '/', 'http://testurl'))
c.execute("INSERT INTO jobs(name,state,runner_id,submit_time, " \
Expand Down
10 changes: 5 additions & 5 deletions test/backend/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
else:
from io import BytesIO as StringIO
import saliweb.backend.events
from saliweb.backend import SGERunner, SaliSGERunner, WyntonSGERunner, Job
from saliweb.backend import SGERunner, WyntonSGERunner, Job
import testutil
import re
import os
Expand All @@ -16,7 +16,7 @@

class BrokenRunner(SGERunner):
# Duplicate runner name, so it shouldn't work
_runner_name = 'qb3ogs'
_runner_name = 'wyntonsge'


class DummyDRMAAModule(object):
Expand Down Expand Up @@ -48,7 +48,7 @@ def synchronize(self, jobids, timeout, cleanup):
def wait(self, jobids, timeout):
return True

class TestRunner(SGERunner):
class TestRunner(WyntonSGERunner):
@classmethod
def _get_drmaa(cls):
return DummyDRMAAModule(), DummyDRMAASession()
Expand Down Expand Up @@ -78,7 +78,7 @@ def test_sge_name(self):

def test_generate_script(self):
"""Check that SGERunner generates reasonable scripts"""
for runner in (SGERunner, SaliSGERunner, WyntonSGERunner):
for runner in (WyntonSGERunner,):
r = runner('echo foo', interpreter='/bin/csh')
r.set_sge_options('-l diva1=1G')
r.set_sge_name('test\t job ')
Expand Down Expand Up @@ -143,7 +143,7 @@ class Session(object):
def initialize(self): pass
def exit(self): pass
sys.modules['drmaa'] = DummyDRMAA()
r = SGERunner('test.sh')
r = WyntonSGERunner('test.sh')
d, s = r._get_drmaa()
self.assertIsInstance(d, DummyDRMAA)
self.assertIsInstance(s, DummyDRMAA.Session)
Expand Down
2 changes: 1 addition & 1 deletion test/backend/test_webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def test_get_job_by_name(self):
def test_get_job_by_runner_id(self):
"""Check WebService._get_job_by_runner_id()"""
db, conf, web = self._setup_webservice()
goodrunner = saliweb.backend.SaliSGERunner('foo')
goodrunner = saliweb.backend.WyntonSGERunner('foo')
badrunner = saliweb.backend.LocalRunner('foo')
job = web._get_job_by_runner_id(goodrunner, 'job-2')
self.assertEqual(job.name, 'job2')
Expand Down

0 comments on commit 89ce87b

Please sign in to comment.