diff --git a/.gitattributes b/.gitattributes index 5cacfbd2c454252bc13797a681b37512db351662..ece505910f51c236392a379b6b8e3b1ea35950ff 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4128,9 +4128,9 @@ MAC/Navigator2/scripts/monitorStationAlarms.ctl -text MAC/Navigator2/scripts/readStationConfigs.ctl -text MAC/Navigator2/scripts/readStationConnections.ctl -text MAC/Navigator2/scripts/transferMPs.ctl -text -MAC/Services/src/pipelinestarter -text -MAC/Services/src/pipelinestarter.ini -text -MAC/Services/test/tPipelineStarter.sh eol=lf +MAC/Services/src/pipelinecontrol -text +MAC/Services/src/pipelinecontrol.ini -text +MAC/Services/test/tPipelineControl.sh eol=lf MAC/Test/APL/PVSSproject/colorDB/Lofar[!!-~]colors -text svneol=native#application/octet-stream MAC/Test/APL/PVSSproject/colorDB/colorDB_de -text svneol=native#application/octet-stream MAC/Test/APL/PVSSproject/config/config -text svneol=native#application/octet-stream diff --git a/MAC/Services/src/CMakeLists.txt b/MAC/Services/src/CMakeLists.txt index cf4cde0d7b67233ff6d253367b050127a0f15439..692b7b5ce4ab157ee88c3d60c29c3c350723c0ab 100644 --- a/MAC/Services/src/CMakeLists.txt +++ b/MAC/Services/src/CMakeLists.txt @@ -1,15 +1,15 @@ # $Id$ lofar_add_bin_scripts( - pipelinestarter + pipelinecontrol ) python_install( - PipelineStarter.py + PipelineControl.py DESTINATION lofar/mac ) # supervisord config files install(FILES - pipelinestarter.ini + pipelinecontrol.ini DESTINATION etc/supervisord.d) diff --git a/MAC/Services/src/PipelineStarter.py b/MAC/Services/src/PipelineControl.py similarity index 97% rename from MAC/Services/src/PipelineStarter.py rename to MAC/Services/src/PipelineControl.py index 3046dec76f676f9673b00323a16f0439fb5cb0ea..48e2bee4838ba8f49bcf636564851d0339022912 100755 --- a/MAC/Services/src/PipelineStarter.py +++ b/MAC/Services/src/PipelineControl.py @@ -26,7 +26,7 @@ using SLURM and Docker, and puts the jobs to QUEUED. The execution chain is as follows: -[SCHEDULED] -> PipelineStarter schedules +[SCHEDULED] -> PipelineControl schedules runPipeline.sh <obsid> || pipelineAborted.sh <obsid> @@ -167,9 +167,9 @@ class Slurm(object): return jobs -class PipelineStarter(OTDBBusListener): +class PipelineControl(OTDBBusListener): def __init__(self, otdb_busname=None, setStatus_busname=None, **kwargs): - super(PipelineStarter, self).__init__(busname=otdb_busname, **kwargs) + super(PipelineControl, self).__init__(busname=otdb_busname, **kwargs) self.parset_rpc = RPC(service="TaskSpecification", busname=otdb_busname, ForwardExceptions=True) self.setStatus_busname = setStatus_busname if setStatus_busname else otdb_busname @@ -187,10 +187,10 @@ class PipelineStarter(OTDBBusListener): def start_listening(self, **kwargs): self.parset_rpc.open() - super(PipelineStarter, self).start_listening(**kwargs) + super(PipelineControl, self).start_listening(**kwargs) def stop_listening(self, **kwargs): - super(PipelineStarter, self).stop_listening(**kwargs) + super(PipelineControl, self).stop_listening(**kwargs) self.parset_rpc.close() diff --git a/MAC/Services/src/pipelinestarter b/MAC/Services/src/pipelinecontrol similarity index 100% rename from MAC/Services/src/pipelinestarter rename to MAC/Services/src/pipelinecontrol diff --git a/MAC/Services/src/pipelinestarter.ini b/MAC/Services/src/pipelinecontrol.ini similarity index 70% rename from MAC/Services/src/pipelinestarter.ini rename to MAC/Services/src/pipelinecontrol.ini index 0d68a1f961bfd92f99f1bfc28c7728a1254740c8..c80c5381d5f33054daeed1b43ae9de9406ce09e5 100644 --- a/MAC/Services/src/pipelinestarter.ini +++ b/MAC/Services/src/pipelinecontrol.ini @@ -1,5 +1,5 @@ [program:PipelineStarter] -command=/bin/bash -c 'source $LOFARROOT/lofarinit.sh;pipelinestarter' +command=/bin/bash -c 'source $LOFARROOT/lofarinit.sh;pipelinecontrol' user=lofarsys stopsignal=INT ; KeyboardInterrupt stopasgroup=true diff --git a/MAC/Services/test/CMakeLists.txt b/MAC/Services/test/CMakeLists.txt index 86b9a1579b884b096c2b5362873d2da9fa3b8da2..b1f0434a8f1707e19fd427b3127dd71721809014 100644 --- a/MAC/Services/test/CMakeLists.txt +++ b/MAC/Services/test/CMakeLists.txt @@ -4,5 +4,5 @@ include(LofarCTest) lofar_find_package(Python REQUIRED) -lofar_add_test(tPipelineStarter) +lofar_add_test(tPipelineControl) diff --git a/MAC/Services/test/tPipelineStarter.py b/MAC/Services/test/tPipelineControl.py similarity index 94% rename from MAC/Services/test/tPipelineStarter.py rename to MAC/Services/test/tPipelineControl.py index 61ea9e143e97eae532471d4f692ed1e102fc0333..4f388a788a28f64beeaceb800ac849559176d63d 100644 --- a/MAC/Services/test/tPipelineStarter.py +++ b/MAC/Services/test/tPipelineControl.py @@ -3,7 +3,7 @@ # Be able to find service python file import sys -from lofar.mac.PipelineStarter import * +from lofar.mac.PipelineControl import * from lofar.sas.otdb.OTDBBusListener import OTDBBusListener from lofar.messaging import ToBus, Service, EventMessage @@ -57,14 +57,14 @@ class TestRunCommand(unittest.TestCase): class TestSlurmJobs(unittest.TestCase): def test_no_jobs(self): """ Test 'scontrol show job' output if there are no jobs. """ - with patch('lofar.mac.PipelineStarter.Slurm._runCommand') as MockRunSlurmCommand: + with patch('lofar.mac.PipelineControl.Slurm._runCommand') as MockRunSlurmCommand: MockRunSlurmCommand.return_value = """No jobs in the system""" self.assertEqual(Slurm().jobs(), {}) def test_one_job(self): """ Test 'scontrol show job' output for a single job. """ - with patch('lofar.mac.PipelineStarter.Slurm._runCommand') as MockRunSlurmCommand: + with patch('lofar.mac.PipelineControl.Slurm._runCommand') as MockRunSlurmCommand: MockRunSlurmCommand.return_value = """JobId=119 JobName=foo UserId=mol(7261) GroupId=mol(7261) Priority=4294901736 Nice=0 Account=(null) QOS=(null) JobState=RUNNING Reason=None Dependency=(null) Requeue=1 Restarts=0 BatchFlag=0 Reboot=0 ExitCode=0:0 RunTime=00:00:07 TimeLimit=UNLIMITED TimeMin=N/A SubmitTime=2016-03-04T12:05:52 EligibleTime=2016-03-04T12:05:52 StartTime=2016-03-04T12:05:52 EndTime=Unknown PreemptTime=None SuspendTime=None SecsPreSuspend=0 Partition=cpu AllocNode:Sid=thead01:7040 ReqNodeList=(null) ExcNodeList=(null) NodeList=tcpu[01-02] BatchHost=tcpu01 NumNodes=2 NumCPUs=2 CPUs/Task=1 ReqB:S:C:T=0:0:*:* TRES=cpu=2,mem=6000,node=2 Socks/Node=* NtasksPerN:B:S:C=0:0:*:* CoreSpec=* MinCPUsNode=1 MinMemoryNode=3000M MinTmpDiskNode=0 Features=(null) Gres=(null) Reservation=(null) Shared=OK Contiguous=0 Licenses=(null) Network=(null) Command=(null) WorkDir=/home/mol Power= SICP=0""" jobs = Slurm().jobs() @@ -73,7 +73,7 @@ class TestSlurmJobs(unittest.TestCase): def test_two_jobs(self): """ Test 'scontrol show job' output for multiple jobs. """ - with patch('lofar.mac.PipelineStarter.Slurm._runCommand') as MockRunSlurmCommand: + with patch('lofar.mac.PipelineControl.Slurm._runCommand') as MockRunSlurmCommand: MockRunSlurmCommand.return_value = """JobId=120 JobName=foo UserId=mol(7261) GroupId=mol(7261) Priority=4294901735 Nice=0 Account=(null) QOS=(null) JobState=RUNNING Reason=None Dependency=(null) Requeue=1 Restarts=0 BatchFlag=0 Reboot=0 ExitCode=0:0 RunTime=00:00:17 TimeLimit=UNLIMITED TimeMin=N/A SubmitTime=2016-03-04T12:09:53 EligibleTime=2016-03-04T12:09:53 StartTime=2016-03-04T12:09:53 EndTime=Unknown PreemptTime=None SuspendTime=None SecsPreSuspend=0 Partition=cpu AllocNode:Sid=thead01:7250 ReqNodeList=(null) ExcNodeList=(null) NodeList=tcpu[01-02] BatchHost=tcpu01 NumNodes=2 NumCPUs=2 CPUs/Task=1 ReqB:S:C:T=0:0:*:* TRES=cpu=2,mem=6000,node=2 Socks/Node=* NtasksPerN:B:S:C=0:0:*:* CoreSpec=* MinCPUsNode=1 MinMemoryNode=3000M MinTmpDiskNode=0 Features=(null) Gres=(null) Reservation=(null) Shared=OK Contiguous=0 Licenses=(null) Network=(null) Command=(null) WorkDir=/home/mol Power= SICP=0 JobId=121 JobName=bar UserId=mol(7261) GroupId=mol(7261) Priority=4294901734 Nice=0 Account=(null) QOS=(null) JobState=PENDING Reason=Resources Dependency=(null) Requeue=1 Restarts=0 BatchFlag=0 Reboot=0 ExitCode=0:0 RunTime=00:00:00 TimeLimit=UNLIMITED TimeMin=N/A SubmitTime=2016-03-04T12:09:59 EligibleTime=2016-03-04T12:09:59 StartTime=2017-03-04T12:09:53 EndTime=Unknown PreemptTime=None SuspendTime=None SecsPreSuspend=0 Partition=cpu AllocNode:Sid=thead01:7250 ReqNodeList=(null) ExcNodeList=(null) NodeList=(null) NumNodes=2-2 NumCPUs=2 CPUs/Task=1 ReqB:S:C:T=0:0:*:* TRES=cpu=2,node=2 Socks/Node=* NtasksPerN:B:S:C=0:0:*:* CoreSpec=* MinCPUsNode=1 MinMemoryNode=0 MinTmpDiskNode=0 Features=(null) Gres=(null) Reservation=(null) Shared=OK Contiguous=0 Licenses=(null) Network=(null) Command=(null) WorkDir=/home/mol Power= SICP=0""" @@ -84,7 +84,7 @@ class TestSlurmJobs(unittest.TestCase): self.assertEqual(jobs["bar"]["JobName"], "bar") self.assertEqual(jobs["bar"]["JobId"], "121") -class TestPipelineStarterClassMethods(unittest.TestCase): +class TestPipelineControlClassMethods(unittest.TestCase): def test_shouldHandle(self): """ Test whether we filter the right OTDB trees. """ @@ -101,9 +101,9 @@ class TestPipelineStarterClassMethods(unittest.TestCase): for t in trials: parset = { "ObsSW.Observation.processType": t["type"], "ObsSW.Observation.Cluster.ProcessingCluster.clusterName": t["cluster"] } - self.assertEqual(PipelineStarter._shouldHandle(Parset(parset)), t["shouldHandle"]) + self.assertEqual(PipelineControl._shouldHandle(Parset(parset)), t["shouldHandle"]) -class TestPipelineStarter(unittest.TestCase): +class TestPipelineControl(unittest.TestCase): def setUp(self): # Create a random bus self.busname = "%s-%s" % (sys.argv[0], str(uuid.uuid4())[:8]) @@ -132,12 +132,12 @@ class TestPipelineStarter(unittest.TestCase): # "4" is an observation, so no SLURM job } - patcher = patch('lofar.mac.PipelineStarter.Slurm') + patcher = patch('lofar.mac.PipelineControl.Slurm') patcher.start().side_effect = MockSlurm self.addCleanup(patcher.stop) # Catch functions to prevent running executables - patcher = patch('lofar.mac.PipelineStarter.Parset.dockerTag') + patcher = patch('lofar.mac.PipelineControl.Parset.dockerTag') patcher.start().return_value = "trunk" self.addCleanup(patcher.stop) @@ -206,7 +206,7 @@ class TestPipelineStarter(unittest.TestCase): self.trigger = MethodTrigger(listener, "onObservationQueued") def test_setStatus(self): - with PipelineStarter(otdb_busname=self.busname, setStatus_busname=self.busname) as ps: + with PipelineControl(otdb_busname=self.busname, setStatus_busname=self.busname) as ps: ps._setStatus(12345, "queued") # Wait for the staatus to propagate @@ -219,7 +219,7 @@ class TestPipelineStarter(unittest.TestCase): 3 requires nothing """ - with PipelineStarter(otdb_busname=self.busname, setStatus_busname=self.busname) as ps: + with PipelineControl(otdb_busname=self.busname, setStatus_busname=self.busname) as ps: # Send fake status update ps._setStatus(3, "scheduled") @@ -241,7 +241,7 @@ class TestPipelineStarter(unittest.TestCase): 2 requires 3 4 is an observation """ - with PipelineStarter(otdb_busname=self.busname, setStatus_busname=self.busname) as ps: + with PipelineControl(otdb_busname=self.busname, setStatus_busname=self.busname) as ps: # Send fake status update ps._setStatus(1, "scheduled") diff --git a/MAC/Services/test/tPipelineControl.sh b/MAC/Services/test/tPipelineControl.sh new file mode 100755 index 0000000000000000000000000000000000000000..b209e84048b346972b79287a1691a15fb13ac6f7 --- /dev/null +++ b/MAC/Services/test/tPipelineControl.sh @@ -0,0 +1,2 @@ +#!/bin/sh +./runctest.sh tPipelineControl diff --git a/MAC/Services/test/tPipelineStarter.sh b/MAC/Services/test/tPipelineStarter.sh deleted file mode 100755 index d3a7329b76f69d24a4382b7f73f379473c75c76e..0000000000000000000000000000000000000000 --- a/MAC/Services/test/tPipelineStarter.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tPipelineStarter diff --git a/SubSystems/RAServices/RAServices.ini b/SubSystems/RAServices/RAServices.ini index cf1dd05a9d08e29b0b949994ea3beac90a9e7c61..a9700f3f99920ac2f3f34c36bd465d6f153a4a93 100644 --- a/SubSystems/RAServices/RAServices.ini +++ b/SubSystems/RAServices/RAServices.ini @@ -5,4 +5,4 @@ programs=TreeService,TreeStatusEvents programs=raewebservice,radbservice,radbpglistener,RATaskSpecified [group:MAC] -programs=pipelinestarter +programs=pipelinecontrol