Commit bedb988d authored by Philip ABBET's avatar Philip ABBET
Browse files

Update to the latest beat.core changes (1.4.1)

parent c859122b
......@@ -42,7 +42,7 @@ import socket
CORES = psutil.cpu_count()
RAM = psutil.virtual_memory().total/(1024*1024)
ENVIRONMENT = {'name': 'environment', 'version': '1'}
ENVIRONMENT = {'name': 'Python 2.7', 'version': '1.1.0'}
CXX_ENVIRONMENT = {'name': 'Cxx backend', 'version': '1.0.0'}
ENVKEY = '%(name)s (%(version)s)' % ENVIRONMENT
CXX_ENVKEY = '%(name)s (%(version)s)' % CXX_ENVIRONMENT
......
......@@ -75,7 +75,7 @@ QUEUES_WITHOUT_PRIORITY = {
"time-limit": 180, #3 hours
"cores-per-slot": 1,
"max-slots-per-user": 4,
"environments": ['environment (1)'],
"environments": ['Python 2.7 (1.1.0)'],
"groups": [
"Default",
],
......@@ -92,7 +92,7 @@ QUEUES_WITHOUT_PRIORITY = {
"time-limit": 360, #6 hours
"cores-per-slot": 2,
"max-slots-per-user": 2,
"environments": ['environment (1)'],
"environments": ['Python 2.7 (1.1.0)'],
"groups": [
"Default",
],
......@@ -109,7 +109,7 @@ QUEUES_WITHOUT_PRIORITY = {
"time-limit": 720, #12 hours
"cores-per-slot": 4,
"max-slots-per-user": 1,
"environments": ['environment (1)'],
"environments": ['Python 2.7 (1.1.0)'],
"groups": [
"Default",
],
......@@ -129,9 +129,9 @@ QUEUES_WITHOUT_PRIORITY = {
}
},
"environments": {
'environment (1)': {
"name": 'environment',
"version": '1',
'Python 2.7 (1.1.0)': {
"name": 'Python 2.7',
"version": '1.1.0',
"short_description": "Test",
"description": "Test environment",
"languages": "python",
......@@ -147,7 +147,7 @@ PRIORITY_QUEUES = {
"time-limit": 180, #3 hours
"cores-per-slot": 1,
"max-slots-per-user": 2,
"environments": ['environment (1)'],
"environments": ['Python 2.7 (1.1.0)'],
"groups": [
"Default",
],
......@@ -168,7 +168,7 @@ PRIORITY_QUEUES = {
"time-limit": 360, #6 hours
"cores-per-slot": 2,
"max-slots-per-user": 1,
"environments": ['environment (1)'],
"environments": ['Python 2.7 (1.1.0)'],
"groups": [
"Default",
],
......@@ -189,7 +189,7 @@ PRIORITY_QUEUES = {
"time-limit": 180, #3 hours
"cores-per-slot": 1,
"max-slots-per-user": 8,
"environments": ['environment (1)'],
"environments": ['Python 2.7 (1.1.0)'],
"groups": [
"Default",
],
......@@ -219,9 +219,9 @@ PRIORITY_QUEUES = {
)
]),
"environments": {
'environment (1)': {
"name": 'environment',
"version": '1',
'Python 2.7 (1.1.0)': {
"name": 'Python 2.7',
"version": '1.1.0',
"short_description": "Test",
"description": "Test environment",
"languages": "python",
......@@ -383,7 +383,7 @@ class BaseBackendTestCase(TestCase):
setup_backend(qsetup.DEFAULT_CONFIGURATION)
Worker.objects.update(active=True)
env = Environment.objects.get(name='environment')
env = Environment.objects.get(name='Python 2.7')
queue = Queue.objects.first()
template_data = dict(
......@@ -420,7 +420,7 @@ class BaseBackendTestCase(TestCase):
self.assertEqual(b0.job.parent, None)
self.assertEqual(b0.job.child_, None)
self.assertEqual(b0.queue.name, 'queue')
self.assertEqual(b0.environment.name, 'environment')
self.assertEqual(b0.environment.name, 'Python 2.7')
self.assertEqual(b0.required_slots, 1)
self.assertEqual(b0.inputs.count(), 1)
self.assertEqual(b0.outputs.count(), 1)
......@@ -441,7 +441,7 @@ class BaseBackendTestCase(TestCase):
self.assertEqual(b1.job.parent, None)
self.assertEqual(b1.job.child_, None)
self.assertEqual(b1.queue.name, 'queue')
self.assertEqual(b1.environment.name, 'environment')
self.assertEqual(b1.environment.name, 'Python 2.7')
self.assertEqual(b1.required_slots, 1)
self.assertEqual(b1.inputs.count(), 1)
self.assertEqual(b1.outputs.count(), 1)
......@@ -527,8 +527,8 @@ class BackendSetup(BaseBackendTestCase):
env = q1.environments.first()
self.assertEqual(env.name, 'environment')
self.assertEqual(env.version, '1')
self.assertEqual(env.name, 'Python 2.7')
self.assertEqual(env.version, '1.1.0')
self.assertEqual(q1.slots.count(), 1)
self.assertEqual(q2.slots.count(), 1)
......@@ -636,8 +636,8 @@ class BackendSetup(BaseBackendTestCase):
env = q1.environments.first()
self.assertEqual(env.name, 'environment')
self.assertEqual(env.version, '1')
self.assertEqual(env.name, 'Python 2.7')
self.assertEqual(env.version, '1.1.0')
self.assertEqual(q1.slots.count(), 2)
self.assertEqual(q1_special.slots.count(), 2)
......@@ -1962,7 +1962,7 @@ class SchedulingPriority(BaseBackendTestCase):
q1 = Queue.objects.get(name='q1')
q2 = Queue.objects.get(name='q2')
env = Environment.objects.get(name='environment')
env = Environment.objects.get(name='Python 2.7')
# reset queue and environment to new backend configuration
self.set_globals(xp, q1, env)
......@@ -2009,7 +2009,7 @@ class SchedulingPriority(BaseBackendTestCase):
q1 = Queue.objects.get(name='q1')
q4 = Queue.objects.get(name='q4')
env = Environment.objects.get(name='environment')
env = Environment.objects.get(name='Python 2.7')
# reset queue and environment to new backend configuration
self.set_globals(xp, q1, env)
......@@ -2049,7 +2049,7 @@ class SchedulingPriority(BaseBackendTestCase):
Worker.objects.update(active=True)
q1 = Queue.objects.get(name='q1')
env = Environment.objects.get(name='environment')
env = Environment.objects.get(name='Python 2.7')
fullname = 'user/user/single/1/single'
xp = Experiment.objects.get(name=fullname.split(os.sep)[-1])
......@@ -2560,7 +2560,7 @@ class WorkingExternally(TransactionTestCase):
setup_backend(qsetup.DEFAULT_CONFIGURATION)
Worker.objects.update(active=True)
env = Environment.objects.get(name='environment')
env = Environment.objects.get(name='Python 2.7')
queue = Queue.objects.first()
template_data = dict(
......
......@@ -1169,16 +1169,23 @@ class Block(models.Model):
info = dict(
cpu_time = statistics.cpu['user'] + statistics.cpu['system'],
max_memory = statistics.memory['rss'],
data_read_size = statistics.data['volume']['read'],
data_read_nb_blocks = statistics.data['blocks']['read'],
data_read_time = statistics.data['time']['read'],
data_written_size = statistics.data['volume']['write'],
data_written_nb_blocks = statistics.data['blocks']['write'],
data_written_time = statistics.data['time']['write'],
stdout = result_stdout,
stderr = result_stderr,
error_report = self.job.result.usrerr,
)
)
if 'volume' in statistics.data:
info['data_read_size'] = statistics.data['volume'].get('read', 0)
info['data_written_size'] = statistics.data['volume'].get('write', 0)
if 'blocks' in statistics.data:
info['data_read_nb_blocks'] = statistics.data['blocks'].get('read', 0)
info['data_written_nb_blocks'] = statistics.data['blocks'].get('write', 0)
if 'time' in statistics.data:
info['data_read_time'] = statistics.data['time'].get('read', 0)
info['data_written_time'] = statistics.data['time'].get('write', 0)
if timings:
info.update(dict(
......
......@@ -48,6 +48,7 @@ if 'beat.cmdline' in sys.argv:
LOGGING['handlers']['console']['level'] = 'DEBUG'
LOGGING['loggers']['beat.core']['handlers'] = ['discard']
LOGGING['loggers']['beat.web']['handlers'] = ['discard']
LOGGING['loggers']['beat.web.utils.management.commands']['handlers'] = ['discard']
PREFIX = os.environ.get('BEAT_TEST_PREFIX', os.path.realpath('./test_prefix'))
......
......@@ -58,11 +58,17 @@ def updateStatistics(stats, date=None):
# Modify the obj entry
obj.cpu_time += stats.cpu['user'] + stats.cpu['system']
obj.max_memory += stats.memory['rss']
obj.data_read_size += stats.data['volume']['read']
obj.data_read_nb_blocks += stats.data['blocks']['read']
obj.data_read_time += stats.data['time']['read']
obj.data_written_size += stats.data['volume']['write']
obj.data_written_nb_blocks += stats.data['blocks']['write']
obj.data_written_time += stats.data['time']['write']
if 'volume' in stats.data:
obj.data_read_size += stats.data['volume'].get('read', 0)
obj.data_written_size += stats.data['volume'].get('write', 0)
if 'blocks' in stats.data:
obj.data_read_nb_blocks += stats.data['blocks'].get('read', 0)
obj.data_written_nb_blocks += stats.data['blocks'].get('write', 0)
if 'time' in stats.data:
obj.data_read_time += stats.data['time'].get('read', 0)
obj.data_written_time += stats.data['time'].get('write', 0)
obj.save()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment