From e0cea0f5da504bac9ce525b1e9908a4b7ba4c08c Mon Sep 17 00:00:00 2001 From: Hyungro Lee Date: Tue, 28 Jan 2020 14:43:48 -0500 Subject: [PATCH 1/2] rp_inspect/plot_state.py requires rp, which is added to setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9626a336..c9456e93 100755 --- a/setup.py +++ b/setup.py @@ -223,7 +223,8 @@ def run (self) : 'package_data' : {'': ['*.txt', '*.sh', '*.json', '*.gz', '*.c', '*.md', 'VERSION', 'SDIST', sdist_name]}, # 'setup_requires' : ['pytest-runner'], - 'install_requires' : ['radical.utils>=0.90', + 'install_requires' : ['radical.pilot>=1.0.0', + 'radical.utils>=0.90', 'matplotlib<=3.0', 'psutil', 'pandas', From d48aeaf3db55a8f7a5d77197df277655abbd28aa Mon Sep 17 00:00:00 2001 From: Andre Merzky Date: Wed, 29 Jan 2020 22:59:00 +0100 Subject: [PATCH 2/2] nicer warnings on missing runtime dependencies --- bin/radical-analytics-check | 7 ++++++- bin/radical-analytics-inspect | 9 +++++++++ setup.py | 3 +-- src/radical/analytics/experiment.py | 2 -- src/radical/analytics/session.py | 20 +++++++++++++++++--- 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/bin/radical-analytics-check b/bin/radical-analytics-check index 212f551a..3bf9ef41 100755 --- a/bin/radical-analytics-check +++ b/bin/radical-analytics-check @@ -38,7 +38,12 @@ if __name__ == '__main__': found_events = set() all_events = dict() - import radical.pilot as rp + try: + import radical.pilot as rp + except: + print('%s requires radical.pilot, please install it.' % sys.argv[0]) + sys.exit(1) + rp_path = os.path.dirname(rp.__file__) ev_path = '%s/../../../../../share/radical.pilot/events.md' % rp_path diff --git a/bin/radical-analytics-inspect b/bin/radical-analytics-inspect index baff53d4..175eda5e 100755 --- a/bin/radical-analytics-inspect +++ b/bin/radical-analytics-inspect @@ -3,6 +3,15 @@ # FIXME: use metric definitions from RP (include colors and labels) # FIXME: use common plotter in src/ra/plotter.py (move from bin/ra-plot) +python -c 'import radical.pilot' > /dev/null 2>&1 +if ! test "$?" = 0 +then + echo + echo "$0 requires radical.pilot, please install it." + echo + exit 1 +fi + ARGS=$* bin="$( cd "$(dirname "$0")" ; pwd -P )" diff --git a/setup.py b/setup.py index c9456e93..aa5c774b 100755 --- a/setup.py +++ b/setup.py @@ -223,8 +223,7 @@ def run (self) : 'package_data' : {'': ['*.txt', '*.sh', '*.json', '*.gz', '*.c', '*.md', 'VERSION', 'SDIST', sdist_name]}, # 'setup_requires' : ['pytest-runner'], - 'install_requires' : ['radical.pilot>=1.0.0', - 'radical.utils>=0.90', + 'install_requires' : ['radical.utils>=1.0', 'matplotlib<=3.0', 'psutil', 'pandas', diff --git a/src/radical/analytics/experiment.py b/src/radical/analytics/experiment.py index 8df26033..d8e3cbe5 100644 --- a/src/radical/analytics/experiment.py +++ b/src/radical/analytics/experiment.py @@ -106,8 +106,6 @@ def utilization(self, metrics): # obtain resources provisions and consumptions for all sessions for session in self._sessions: - import radical.pilot as rp - sid = session.uid p, c, sa, sr, i = session.utilization(metrics) diff --git a/src/radical/analytics/session.py b/src/radical/analytics/session.py index 60b2343a..2ec58f2a 100644 --- a/src/radical/analytics/session.py +++ b/src/radical/analytics/session.py @@ -94,7 +94,13 @@ def _walkdir(path, profiles=[]): elif stype == 'radical.pilot': - import radical.pilot.utils as rpu + try: + import radical.pilot.utils as rpu + except: + raise RuntimeError('radical.analytics requires the ' + 'radical.pilot module to analyze this ' + 'session - please install it.') + self._profile, accuracy, hostmap \ = rpu.get_session_profile (sid=sid, src=self._src) self._description = rpu.get_session_description(sid=sid, src=self._src) @@ -105,7 +111,12 @@ def _walkdir(path, profiles=[]): elif stype == 'radical.entk': - import radical.entk.utils as reu + try: + import radical.etk.utils as reu + except: + raise RuntimeError('radical.analytics requires the ' + 'radical.entk module to analyze this ' + 'session - please install it.') self._profile, accuracy, hostmap \ = reu.get_session_profile (sid=sid, src=self._src) @@ -955,7 +966,10 @@ def rate(self, state=None, event=None, time=None, sampling=None, # def utilization(self, metrics): - assert(self._stype == 'radical.pilot') + if self._stype != 'radical.pilot': + raise ValueError('session utilization is only available on ' + 'radical.pilot sessions') + import radical.pilot as rp provided = rp.utils.get_provided_resources(self)