Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 08:39:14

0001 #!/usr/bin/env python
0002 # Licensed under the Apache License, Version 2.0 (the "License");
0003 # you may not use this file except in compliance with the License.
0004 # You may obtain a copy of the License at
0005 # http://www.apache.org/licenses/LICENSE-2.0
0006 #
0007 # Authors:
0008 # - Paul Nilsson, paul.nilsson@cern.ch, 2018-2019
0009 
0010 from os import getcwd
0011 from .services import Services
0012 
0013 import logging
0014 logger = logging.getLogger(__name__)
0015 
0016 
0017 class MemoryMonitoring(Services):
0018     """
0019     Memory monitoring service class.
0020     """
0021 
0022     user = ""     # Pilot user, e.g. 'ATLAS'
0023     pid = 0       # Job process id
0024     workdir = ""  # Job work directory
0025     _cmd = ""     # Memory monitoring command (full path, all options)
0026 
0027     def __init__(self, **kwargs):
0028         """
0029         Init function.
0030 
0031         :param kwargs:
0032         """
0033 
0034         for key in kwargs:
0035             setattr(self, key, kwargs[key])
0036 
0037         if not self.workdir:
0038             self.workdir = getcwd()
0039 
0040         if self.user:
0041             user_utility = __import__('pilot.user.%s.utilities' % self.user, globals(), locals(), [self.user], 0)  # Python 2/3
0042             self._cmd = user_utility.get_memory_monitor_setup(self.pid, self.workdir)
0043 
0044     def get_command(self):
0045         """
0046         Return the full command for the memory monitor.
0047 
0048         :return: command string.
0049         """
0050 
0051         return self._cmd
0052 
0053     def execute(self):
0054         """
0055         Execute the memory monitor command.
0056         Return the process.
0057 
0058         :return: process.
0059         """
0060 
0061         return None
0062 
0063     def get_filename(self):
0064         """
0065         ..
0066 
0067         :return:
0068         """
0069 
0070         return ""
0071 
0072     def get_results(self):
0073         """
0074         ..
0075 
0076         :return:
0077         """
0078 
0079         return None