def setUp(self):
     ceParameters = {'WholeNode': True, 'NumberOfProcessors': 4}
     self.ce = PoolComputingElement('TestPoolCE')
     self.ce.setParameters(ceParameters)
     for i in range(4):
         with open('testPoolCEJob_%s.py' % i, 'w') as execFile:
             execFile.write(jobScript % i)
         os.chmod('testPoolCEJob_%s.py' % i, 0755)
def test__getProcessorsForJobs(processorsPerTask, kwargs, expected):
    ce = PoolComputingElement("TestPoolCE")
    ce.processors = 16

    if processorsPerTask:
        ce.processorsPerTask = processorsPerTask
    res = ce._getProcessorsForJobs(kwargs)
    assert res == expected
def test_executeJob_wholeNode4(createAndDelete):

    time.sleep(0.5)

    ceParameters = {"WholeNode": True, "NumberOfProcessors": 4}
    ce = PoolComputingElement("TestPoolCE")
    ce.setParameters(ceParameters)

    # Test that max 4 processors can be used at a time
    result = ce.submitJob("testPoolCEJob_0.py", None)
    assert result["OK"] is True
    result = ce.getCEStatus()
    assert result["UsedProcessors"] == 1
    assert result["AvailableProcessors"] == 3
    assert result["RunningJobs"] == 1

    jobParams = {"mpTag": True, "numberOfProcessors": 2}
    result = ce.submitJob("testPoolCEJob_1.py", None, **jobParams)
    assert result["OK"] is True
    result = ce.getCEStatus()
    assert result["UsedProcessors"] == 3
    assert result["AvailableProcessors"] == 1
    assert result["RunningJobs"] == 2

    # now trying again would fail
    jobParams = {"mpTag": True, "numberOfProcessors": 2}
    result = ce.submitJob("testPoolCEJob_1.py", None, **jobParams)
    assert result["OK"] is False
  def test_executeJob( self ):

    # Test that max 4 processors can be used at a time
    result = self.ce.submitJob( 'testPoolCEJob_0.py', None )
    self.assertTrue( result['OK'] )
    result = self.ce.getCEStatus()
    self.assertEqual( 1, result['UsedProcessors'] )

    jobParams = { 'numberOfProcessors': 2 }
    result = self.ce.submitJob( 'testPoolCEJob_1.py', None, **jobParams )
    self.assertTrue( result['OK'] )
    result = self.ce.getCEStatus()
    self.assertEqual( 3, result['UsedProcessors'] )

    jobParams = { 'numberOfProcessors': 2 }
    result = self.ce.submitJob( 'testPoolCEJob_2.py', None, **jobParams )
    self.assertTrue( not result['OK'] )
    self.assertIn( "Not enough slots", result['Message'] )

    self.__stopJob( 0 )
    jobParams = { 'numberOfProcessors': 2 }
    ce = PoolComputingElement('TestPoolCE')
    ceParameters = { 'WholeNode': False,
                     'NumberOfProcessors': 4 }
    ce.setParameters( ceParameters )
    result = ce.submitJob( 'testPoolCEJob_2.py', None, **jobParams )
    self.assertTrue( result['OK'] )
    result = ce.getCEStatus()
    self.assertEqual( 2, result['UsedProcessors'] )

    for i in range(4):
      self.__stopJob( i )
    time.sleep(1)
    result = self.ce.getCEStatus()
    self.assertEqual( 0, result['UsedProcessors'] )

    # Whole node jobs
    result = self.ce.submitJob( 'testPoolCEJob_0.py', None )
    self.assertTrue( result['OK'] )
    result = self.ce.getCEStatus()
    self.assertEqual( 1, result['UsedProcessors'] )

    jobParams = { 'wholeNode': True }
    result = self.ce.submitJob( 'testPoolCEJob_1.py', None, **jobParams )
    self.assertTrue( not result['OK'] )
    self.assertIn( "Can not take WholeNode job", result['Message'] )

    self.__stopJob( 0 )
    time.sleep(1)

    jobParams = { 'wholeNode': True }
    result = self.ce.submitJob( 'testPoolCEJob_1.py', None, **jobParams )
    self.assertTrue( result['OK'] )
def test_executeJob_submitAndStop(createAndDelete):

    time.sleep(0.5)

    ceParameters = {"WholeNode": True, "NumberOfProcessors": 4}
    ce = PoolComputingElement("TestPoolCE")
    ce.setParameters(ceParameters)

    jobParams = {"mpTag": True, "numberOfProcessors": 2, "maxNumberOfProcessors": 2}
    result = ce.submitJob("testPoolCEJob_0.py", None, **jobParams)
    assert result["OK"] is True
    result = ce.getCEStatus()
    assert result["UsedProcessors"] == 2
    assert result["AvailableProcessors"] == 2
    assert result["RunningJobs"] == 1

    time.sleep(5)
    _stopJob(0)
    # Allow job to stop
    time.sleep(2)

    result = ce.getCEStatus()
    assert result["RunningJobs"] == 0
    assert result["UsedProcessors"] == 0
    assert result["AvailableProcessors"] == 4
 def setUp( self ):
   ceParameters = { 'WholeNode': True,
                    'NumberOfProcessors': 4 }
   self.ce = PoolComputingElement('TestPoolCE')
   self.ce.setParameters( ceParameters )
   for i in range(4):
     with open( 'testPoolCEJob_%s.py' % i, 'w' ) as execFile:
       execFile.write( jobScript % i )
     os.chmod( 'testPoolCEJob_%s.py' % i, 0755  )
    def test_executeJob(self):

        # Test that max 4 processors can be used at a time
        result = self.ce.submitJob('testPoolCEJob_0.py', None)
        self.assertTrue(result['OK'])
        result = self.ce.getCEStatus()
        self.assertEqual(1, result['UsedProcessors'])

        jobParams = {'numberOfProcessors': 2}
        result = self.ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
        self.assertTrue(result['OK'])
        result = self.ce.getCEStatus()
        self.assertEqual(3, result['UsedProcessors'])

        jobParams = {'numberOfProcessors': 2}
        result = self.ce.submitJob('testPoolCEJob_2.py', None, **jobParams)
        self.assertTrue(not result['OK'])
        self.assertIn("Not enough slots", result['Message'])

        self.__stopJob(0)
        jobParams = {'numberOfProcessors': 2}
        ce = PoolComputingElement('TestPoolCE')
        ceParameters = {'WholeNode': False, 'NumberOfProcessors': 4}
        ce.setParameters(ceParameters)
        result = ce.submitJob('testPoolCEJob_2.py', None, **jobParams)
        self.assertTrue(result['OK'])
        result = ce.getCEStatus()
        self.assertEqual(2, result['UsedProcessors'])

        for i in range(4):
            self.__stopJob(i)
        time.sleep(1)
        result = self.ce.getCEStatus()
        self.assertEqual(0, result['UsedProcessors'])

        # Whole node jobs
        result = self.ce.submitJob('testPoolCEJob_0.py', None)
        self.assertTrue(result['OK'])
        result = self.ce.getCEStatus()
        self.assertEqual(1, result['UsedProcessors'])

        jobParams = {'wholeNode': True}
        result = self.ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
        self.assertTrue(not result['OK'])
        self.assertIn("Can not take WholeNode job", result['Message'])

        self.__stopJob(0)
        time.sleep(1)

        jobParams = {'wholeNode': True}
        result = self.ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
        self.assertTrue(result['OK'])
def test_submit_and_shutdown(createAndDelete):

    time.sleep(0.5)

    ceParameters = {"WholeNode": True, "NumberOfProcessors": 4}
    ce = PoolComputingElement("TestPoolCE")
    ce.setParameters(ceParameters)

    result = ce.submitJob("testPoolCEJob_0.py", None)
    assert result["OK"] is True

    result = ce.shutdown()
    assert result["OK"] is True
    assert isinstance(result["Value"], dict)
    assert list(result["Value"].values())[0]["OK"] is True
def test_executeJob_WholeNodeJobs(createAndDelete):

    time.sleep(0.5)

    ce = PoolComputingElement("TestPoolCE")
    ceParameters = {"WholeNode": False, "NumberOfProcessors": 4}
    ce.setParameters(ceParameters)

    jobParams = {"mpTag": True, "numberOfProcessors": 2, "maxNumberOfProcessors": 2}
    result = ce.submitJob("testPoolCEJob_0.py", None, **jobParams)
    assert result["OK"] is True

    jobParams = {"mpTag": True, "numberOfProcessors": 2}
    result = ce.submitJob("testPoolCEJob_5.py", None, **jobParams)
    assert result["OK"] is True
    result = ce.getCEStatus()
    assert result["UsedProcessors"] == 4
    assert result["AvailableProcessors"] == 0
    assert result["RunningJobs"] == 2

    # Allow jobs to start, then stopping them
    time.sleep(5)
    for i in range(8):
        _stopJob(i)
    # Allow jobs to stop
    time.sleep(2)

    result = ce.getCEStatus()
    assert result["UsedProcessors"] == 0

    # Trying with whole node jobs
    result = ce.submitJob("testPoolCEJob_0.py", None)  # first 1 SP job
    assert result["OK"] is True
    result = ce.getCEStatus()
    assert result["UsedProcessors"] == 1

    jobParams = {"mpTag": True, "wholeNode": True}
    result = ce.submitJob("testPoolCEJob_1.py", None, **jobParams)
    assert result["OK"] is False
    assert "Not enough processors for the job" in result["Message"]
    # Allow job to start
    time.sleep(5)

    _stopJob(0)
    # Allow job to stop
    time.sleep(2)

    jobParams = {"mpTag": True, "wholeNode": True}
    result = ce.submitJob("testPoolCEJob_1.py", None, **jobParams)
    assert result["OK"] is True
    result = ce.getCEStatus()
    assert result["UsedProcessors"] == 4
def test_executeJob_wholeNode8(createAndDelete):

    time.sleep(0.5)

    ceParameters = {"WholeNode": True, "NumberOfProcessors": 8}
    ce = PoolComputingElement("TestPoolCE")
    ce.setParameters(ceParameters)

    jobParams = {"mpTag": True, "numberOfProcessors": 2, "maxNumberOfProcessors": 2}
    result = ce.submitJob("testPoolCEJob_2.py", None, **jobParams)
    assert result["OK"] is True
    result = ce.getCEStatus()
    assert result["UsedProcessors"] == 2

    jobParams = {"mpTag": True, "numberOfProcessors": 1, "maxNumberOfProcessors": 3}
    result = ce.submitJob("testPoolCEJob_3.py", None, **jobParams)
    assert result["OK"] is True
    result = ce.getCEStatus()
    assert result["UsedProcessors"] == 5

    jobParams = {"numberOfProcessors": 2}  # This is same as asking for SP
    result = ce.submitJob("testPoolCEJob_4.py", None, **jobParams)
    assert result["OK"] is True
    result = ce.getCEStatus()
    assert result["UsedProcessors"] == 6

    # now trying again would fail
    jobParams = {"mpTag": True, "numberOfProcessors": 3}
    result = ce.submitJob("testPoolCEJob_5.py", None, **jobParams)
    assert result["OK"] is False
    assert "Not enough processors" in result["Message"]

    # waiting 40 seconds and then submit again
    time.sleep(40)
    jobParams = {"mpTag": True, "numberOfProcessors": 3}
    result = ce.submitJob("testPoolCEJob_5.py", None, **jobParams)
    assert result["OK"] is True
    time.sleep(10)

    result = ce.shutdown()
    assert result["OK"] is True
    assert isinstance(result["Value"], dict)
    assert len(result["Value"]) == 4
Exemple #11
0
def test_executeJob():

    ceParameters = {'WholeNode': True, 'NumberOfProcessors': 4}
    ce = PoolComputingElement('TestPoolCE')
    ce.setParameters(ceParameters)

    for i in range(4):
        with open('testPoolCEJob_%s.py' % i, 'w') as execFile:
            execFile.write(jobScript % i)
        os.chmod('testPoolCEJob_%s.py' % i, 0o755)

    # Test that max 4 processors can be used at a time
    result = ce.submitJob('testPoolCEJob_0.py', None)
    assert result['OK'] is True
    result = ce.getCEStatus()
    assert result['UsedProcessors'] == 1

    jobParams = {'mpTag': True, 'numberOfProcessors': 2}
    result = ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
    assert result['OK'] is True

    jobParams = {'mpTag': True, 'numberOfProcessors': 2}
    result = ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
    assert result['OK'] is False

    ceParameters = {'WholeNode': True, 'NumberOfProcessors': 8}
    ce = PoolComputingElement('TestPoolCE')
    ce.setParameters(ceParameters)

    jobParams = {
        'mpTag': True,
        'numberOfProcessors': 2,
        'maxNumberOfProcessors': 2
    }
    result = ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
    assert result['OK'] is True
    result = ce.getCEStatus()
    assert result['UsedProcessors'] == 2

    jobParams = {
        'mpTag': True,
        'numberOfProcessors': 1,
        'maxNumberOfProcessors': 3
    }
    result = ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
    assert result['OK'] is True
    result = ce.getCEStatus()
    assert result['UsedProcessors'] == 5

    jobParams = {'numberOfProcessors': 2}  # This is same as asking for SP
    result = ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
    assert result['OK'] is True
    result = ce.getCEStatus()
    assert result['UsedProcessors'] == 6

    jobParams = {'mpTag': True, 'numberOfProcessors': 3}
    result = ce.submitJob('testPoolCEJob_2.py', None, **jobParams)
    assert result['OK'] is False
    assert "Not enough processors" in result['Message']

    _stopJob(0)

    ce = PoolComputingElement('TestPoolCE')
    ceParameters = {'WholeNode': False, 'NumberOfProcessors': 4}
    ce.setParameters(ceParameters)

    jobParams = {'mpTag': True, 'numberOfProcessors': 2}
    result = ce.submitJob('testPoolCEJob_2.py', None, **jobParams)
    assert result['OK'] is True
    result = ce.getCEStatus()
    assert result['UsedProcessors'] == 4

    for i in range(8):
        _stopJob(i)
    time.sleep(1)
    result = ce.getCEStatus()
    assert result['UsedProcessors'] == 0

    # Whole node jobs
    result = ce.submitJob('testPoolCEJob_0.py', None)
    assert result['OK'] is True
    result = ce.getCEStatus()
    assert result['UsedProcessors'] == 1

    jobParams = {'mpTag': True, 'wholeNode': True}
    result = ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
    assert result['OK'] is False
    assert "Not enough processors for the job" in result['Message']

    _stopJob(0)
    time.sleep(1)

    jobParams = {'mpTag': True, 'wholeNode': True}
    result = ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
    assert result['OK'] is True
    result = ce.getCEStatus()
    assert result['UsedProcessors'] == 4

    # Stop all the jobs if any, cleanup tmp files
    for i in range(8):
        _stopJob(i)
        for ff in ['testPoolCEJob_%s.py' % i, 'stop_job_%s' % i]:
            if os.path.isfile(ff):
                os.unlink(ff)
Exemple #12
0
def test__getProcessorsForJobs():
    ce = PoolComputingElement('TestPoolCE')
    ce.processors = 16

    kwargs = {}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 1

    kwargs = {'mpTag': False}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 1

    kwargs = {'mpTag': True}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 16

    kwargs = {'mpTag': True, 'wholeNode': True}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 16

    kwargs = {'mpTag': True, 'wholeNode': False}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 16

    kwargs = {'mpTag': True, 'numberOfProcessors': 4}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 16

    kwargs = {
        'mpTag': True,
        'numberOfProcessors': 4,
        'maxNumberOfProcessors': 8
    }
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 8

    kwargs = {
        'mpTag': True,
        'numberOfProcessors': 4,
        'maxNumberOfProcessors': 32
    }
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 16

    # something is in use
    ce.processorsPerTask = {1: 4}
    kwargs = {'mpTag': True, 'wholeNode': True}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 0

    kwargs = {'mpTag': True, 'wholeNode': False}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 12

    kwargs = {'mpTag': True, 'numberOfProcessors': 2}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 12

    kwargs = {'mpTag': True, 'maxNumberOfProcessors': 2}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 2

    kwargs = {'mpTag': True, 'maxNumberOfProcessors': 16}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 12
class PoolCETests(unittest.TestCase):
    """ tests for the PoolComputingElement Module """
    def setUp(self):
        ceParameters = {'WholeNode': True, 'NumberOfProcessors': 4}
        self.ce = PoolComputingElement('TestPoolCE')
        self.ce.setParameters(ceParameters)
        for i in range(4):
            with open('testPoolCEJob_%s.py' % i, 'w') as execFile:
                execFile.write(jobScript % i)
            os.chmod('testPoolCEJob_%s.py' % i, 0755)

    def tearDown(self):

        # Stop all the jobs if any, cleanup tmp files
        for i in range(4):
            self.__stopJob(i)
            for ff in ['testPoolCEJob_%s.py' % i, 'stop_job_%s' % i]:
                if os.path.isfile(ff):
                    os.unlink(ff)

    def __stopJob(self, nJob):
        with open('stop_job_%s' % nJob, 'w') as stopFile:
            stopFile.write('Stop')
        time.sleep(0.2)
        if os.path.isfile('stop_job_%s' % nJob):
            os.unlink('stop_job_%s' % nJob)

    def test_executeJob(self):

        # Test that max 4 processors can be used at a time
        result = self.ce.submitJob('testPoolCEJob_0.py', None)
        self.assertTrue(result['OK'])
        result = self.ce.getCEStatus()
        self.assertEqual(1, result['UsedProcessors'])

        jobParams = {'numberOfProcessors': 2}
        result = self.ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
        self.assertTrue(result['OK'])
        result = self.ce.getCEStatus()
        self.assertEqual(3, result['UsedProcessors'])

        jobParams = {'numberOfProcessors': 2}
        result = self.ce.submitJob('testPoolCEJob_2.py', None, **jobParams)
        self.assertTrue(not result['OK'])
        self.assertIn("Not enough slots", result['Message'])

        self.__stopJob(0)
        jobParams = {'numberOfProcessors': 2}
        ce = PoolComputingElement('TestPoolCE')
        ceParameters = {'WholeNode': False, 'NumberOfProcessors': 4}
        ce.setParameters(ceParameters)
        result = ce.submitJob('testPoolCEJob_2.py', None, **jobParams)
        self.assertTrue(result['OK'])
        result = ce.getCEStatus()
        self.assertEqual(2, result['UsedProcessors'])

        for i in range(4):
            self.__stopJob(i)
        time.sleep(1)
        result = self.ce.getCEStatus()
        self.assertEqual(0, result['UsedProcessors'])

        # Whole node jobs
        result = self.ce.submitJob('testPoolCEJob_0.py', None)
        self.assertTrue(result['OK'])
        result = self.ce.getCEStatus()
        self.assertEqual(1, result['UsedProcessors'])

        jobParams = {'wholeNode': True}
        result = self.ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
        self.assertTrue(not result['OK'])
        self.assertIn("Can not take WholeNode job", result['Message'])

        self.__stopJob(0)
        time.sleep(1)

        jobParams = {'wholeNode': True}
        result = self.ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
        self.assertTrue(result['OK'])
Exemple #14
0
def test_executeJob():

  ceParameters = {'WholeNode': True,
                  'NumberOfProcessors': 4}
  ce = PoolComputingElement('TestPoolCE')
  ce.setParameters(ceParameters)

  for i in range(4):
    with open('testPoolCEJob_%s.py' % i, 'w') as execFile:
      execFile.write(jobScript % i)
    os.chmod('testPoolCEJob_%s.py' % i, 0o755)

  # Test that max 4 processors can be used at a time
  result = ce.submitJob('testPoolCEJob_0.py', None)
  assert result['OK'] is True
  result = ce.getCEStatus()
  assert 1 == result['UsedProcessors']

  jobParams = {'numberOfProcessors': 2}
  result = ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
  assert result['OK'] is True
  result = ce.getCEStatus()
  assert 3 == result['UsedProcessors']

  jobParams = {'numberOfProcessors': 2}
  result = ce.submitJob('testPoolCEJob_2.py', None, **jobParams)
  assert result['OK'] is False
  assert "Not enough slots" in result['Message']

  _stopJob(0)
  jobParams = {'numberOfProcessors': 2}
  ce = PoolComputingElement('TestPoolCE')
  ceParameters = {'WholeNode': False,
                  'NumberOfProcessors': 4}
  ce.setParameters(ceParameters)
  result = ce.submitJob('testPoolCEJob_2.py', None, **jobParams)
  assert result['OK'] is True
  result = ce.getCEStatus()
  assert 2 == result['UsedProcessors']

  for i in range(4):
    _stopJob(i)
  time.sleep(1)
  result = ce.getCEStatus()
  assert 0 == result['UsedProcessors']

  # Whole node jobs
  result = ce.submitJob('testPoolCEJob_0.py', None)
  assert result['OK'] is True
  result = ce.getCEStatus()
  assert 1 == result['UsedProcessors']

  jobParams = {'wholeNode': True}
  result = ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
  assert result['OK'] is False
  assert "Can not take WholeNode job" in result['Message']

  _stopJob(0)
  time.sleep(1)

  jobParams = {'wholeNode': True}
  result = ce.submitJob('testPoolCEJob_1.py', None, **jobParams)
  assert result['OK'] is True

  # Stop all the jobs if any, cleanup tmp files
  for i in range(4):
    _stopJob(i)
    for ff in ['testPoolCEJob_%s.py' % i, 'stop_job_%s' % i]:
      if os.path.isfile(ff):
        os.unlink(ff)
class PoolCETests( unittest.TestCase ):
  """ tests for the PoolComputingElement Module """

  def setUp( self ):
    ceParameters = { 'WholeNode': True,
                     'NumberOfProcessors': 4 }
    self.ce = PoolComputingElement('TestPoolCE')
    self.ce.setParameters( ceParameters )
    for i in range(4):
      with open( 'testPoolCEJob_%s.py' % i, 'w' ) as execFile:
        execFile.write( jobScript % i )
      os.chmod( 'testPoolCEJob_%s.py' % i, 0755  )

  def tearDown( self ):

    # Stop all the jobs if any, cleanup tmp files
    for i in range(4):
      self.__stopJob( i )
      for ff in [ 'testPoolCEJob_%s.py' % i, 'stop_job_%s' % i ]:
        if os.path.isfile( ff ):
          os.unlink( ff )

  def __stopJob( self, nJob ):
    with open( 'stop_job_%s' % nJob, 'w' ) as stopFile:
      stopFile.write( 'Stop' )
    time.sleep( 0.2 )
    if os.path.isfile( 'stop_job_%s' % nJob ):
      os.unlink( 'stop_job_%s' % nJob )

  def test_executeJob( self ):

    # Test that max 4 processors can be used at a time
    result = self.ce.submitJob( 'testPoolCEJob_0.py', None )
    self.assertTrue( result['OK'] )
    result = self.ce.getCEStatus()
    self.assertEqual( 1, result['UsedProcessors'] )

    jobParams = { 'numberOfProcessors': 2 }
    result = self.ce.submitJob( 'testPoolCEJob_1.py', None, **jobParams )
    self.assertTrue( result['OK'] )
    result = self.ce.getCEStatus()
    self.assertEqual( 3, result['UsedProcessors'] )

    jobParams = { 'numberOfProcessors': 2 }
    result = self.ce.submitJob( 'testPoolCEJob_2.py', None, **jobParams )
    self.assertTrue( not result['OK'] )
    self.assertIn( "Not enough slots", result['Message'] )

    self.__stopJob( 0 )
    jobParams = { 'numberOfProcessors': 2 }
    ce = PoolComputingElement('TestPoolCE')
    ceParameters = { 'WholeNode': False,
                     'NumberOfProcessors': 4 }
    ce.setParameters( ceParameters )
    result = ce.submitJob( 'testPoolCEJob_2.py', None, **jobParams )
    self.assertTrue( result['OK'] )
    result = ce.getCEStatus()
    self.assertEqual( 2, result['UsedProcessors'] )

    for i in range(4):
      self.__stopJob( i )
    time.sleep(1)
    result = self.ce.getCEStatus()
    self.assertEqual( 0, result['UsedProcessors'] )

    # Whole node jobs
    result = self.ce.submitJob( 'testPoolCEJob_0.py', None )
    self.assertTrue( result['OK'] )
    result = self.ce.getCEStatus()
    self.assertEqual( 1, result['UsedProcessors'] )

    jobParams = { 'wholeNode': True }
    result = self.ce.submitJob( 'testPoolCEJob_1.py', None, **jobParams )
    self.assertTrue( not result['OK'] )
    self.assertIn( "Can not take WholeNode job", result['Message'] )

    self.__stopJob( 0 )
    time.sleep(1)

    jobParams = { 'wholeNode': True }
    result = self.ce.submitJob( 'testPoolCEJob_1.py', None, **jobParams )
    self.assertTrue( result['OK'] )