From 53129d4da41e70e6ed000c3c790c623a012b3c9f Mon Sep 17 00:00:00 2001 From: Samuel Khuvis Date: Sun, 28 Feb 2021 12:10:29 -0800 Subject: [PATCH 1/3] WIP: check for deprecated/removed features --- .../taucmdr/cf/software/tau_installation.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/taucmdr/cf/software/tau_installation.py b/packages/taucmdr/cf/software/tau_installation.py index 598b4ff4c..7938ff422 100644 --- a/packages/taucmdr/cf/software/tau_installation.py +++ b/packages/taucmdr/cf/software/tau_installation.py @@ -1015,6 +1015,8 @@ def install(self, force_reinstall=False): # Keep reconfiguring the same source because that's how TAU works if not (self.include_path and os.path.isdir(self.include_path)): shutil.move(self._prepare_src(), self.install_prefix) + self.tau_version = self.get_tau_version(os.path.join(self.install_prefix, 'include/TAU.h.default')) + self.deprecation_check() self._src_prefix = self.install_prefix self.installation_sequence() self.set_group() @@ -1927,3 +1929,24 @@ def get_python_version(self, python_path): p = re.compile(r'\d+\.\d+\.\d+') m = p.search(out) return m.group() + + def get_tau_version(self, header_path): + with open(header_path) as f: + for line in f: + if line.startswith("#define TAU_VERSION"): + verline = line + break + verstr = re.findall('"([^"]*)"', verline)[0] + if verstr.endswith('-git'): + ver = verstr[:-len('-git')] + return ver + + def deprecation_check(self): + print('deprecation check') + print(self.uses_ompt_tr4) + print(self.uses_ompt_tr6) + print(self.uses_ompt) + if self.uses_ompt_tr4: + LOGGER.warning("\"--ompt download-tr4\" is deprecated in TAU version %s and will be removed in a later release", self.tau_version) + if self.uses_ompt_tr6: + LOGGER.warning("\"--ompt download-tr6\" is deprecated in TAU version %s and will be removed in a later release", self.tau_version) From 6123bd76628bd0b6f0bbe8bf4d6322c07a21f322 Mon Sep 17 00:00:00 2001 From: Samuel Khuvis Date: Sun, 18 Apr 2021 13:15:14 -0700 Subject: [PATCH 2/3] WIP: check for deprecated/removed features --- .../taucmdr/cf/software/tau_installation.py | 16 +++--------- packages/taucmdr/model/experiment.py | 26 +++++++++++++++++++ packages/taucmdr/model/target.py | 4 +++ 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/packages/taucmdr/cf/software/tau_installation.py b/packages/taucmdr/cf/software/tau_installation.py index 7938ff422..9f4c52d33 100644 --- a/packages/taucmdr/cf/software/tau_installation.py +++ b/packages/taucmdr/cf/software/tau_installation.py @@ -1015,8 +1015,7 @@ def install(self, force_reinstall=False): # Keep reconfiguring the same source because that's how TAU works if not (self.include_path and os.path.isdir(self.include_path)): shutil.move(self._prepare_src(), self.install_prefix) - self.tau_version = self.get_tau_version(os.path.join(self.install_prefix, 'include/TAU.h.default')) - self.deprecation_check() + self.tau_version = self.get_version(os.path.join(self.install_prefix, 'include/TAU.h.default')) self._src_prefix = self.install_prefix self.installation_sequence() self.set_group() @@ -1930,7 +1929,8 @@ def get_python_version(self, python_path): m = p.search(out) return m.group() - def get_tau_version(self, header_path): + def get_version(self): + header_path = os.path.join(self.install_prefix, 'include/TAU.h.default') with open(header_path) as f: for line in f: if line.startswith("#define TAU_VERSION"): @@ -1940,13 +1940,3 @@ def get_tau_version(self, header_path): if verstr.endswith('-git'): ver = verstr[:-len('-git')] return ver - - def deprecation_check(self): - print('deprecation check') - print(self.uses_ompt_tr4) - print(self.uses_ompt_tr6) - print(self.uses_ompt) - if self.uses_ompt_tr4: - LOGGER.warning("\"--ompt download-tr4\" is deprecated in TAU version %s and will be removed in a later release", self.tau_version) - if self.uses_ompt_tr6: - LOGGER.warning("\"--ompt download-tr6\" is deprecated in TAU version %s and will be removed in a later release", self.tau_version) diff --git a/packages/taucmdr/model/experiment.py b/packages/taucmdr/model/experiment.py index fa7c7889d..a103d2653 100644 --- a/packages/taucmdr/model/experiment.py +++ b/packages/taucmdr/model/experiment.py @@ -94,6 +94,10 @@ def attributes(): 'type': 'string', 'description': 'TAU Makefile used during this experiment, if any.' }, + 'tau_version': { + 'type': 'string', + 'description': 'TAU version used during this experiment' + }, 'record_output': { 'type': 'boolean', 'default': False, @@ -234,6 +238,26 @@ def verify(self): for rhs in [targ, app, meas]: lhs.check_compatibility(rhs) + # Check for deprecated attributes + if 'tau_version' in self.controller(self.storage).search(self.eid)[0]: + tau_version_str = self.controller(self.storage).search(self.eid)[0]['tau_version'] + tau_version = [int(i) for i in tau_version_str.split('.')] + tau_version.extend([0]*(3-len(tau_version))) + else: + return + for comp in [targ, app, meas]: + for attr, props in comp.attributes.iteritems(): + if 'deprecated' in props: + if comp.controller(self.storage).search(self.eid)[0][attr] in props['deprecated']: + deprecated_option = comp.controller(self.storage).search(self.eid)[0][attr] + depr_str = props['deprecated'][targ[attr]] + depr = [int(i) for i in depr_str.split('.')] + depr.extend([0]*(3-len(depr))) + if tau_version >= depr: + LOGGER.warning( + "The \"--%s %s\" has been deprecated in TAU version %s and will be removed in a future release." %(attr, deprecated_option, depr_str) + ) + def on_create(self): self.verify() try: @@ -347,6 +371,8 @@ def configure(self): tau.install() if not baseline: self.controller(self.storage).update({'tau_makefile': os.path.basename(tau.get_makefile())}, self.eid) + self.controller(self.storage).update({'tau_version': tau.get_version()}, self.eid) + self.verify() return tau def managed_build(self, compiler_cmd, compiler_args): diff --git a/packages/taucmdr/model/target.py b/packages/taucmdr/model/target.py index 8975ae7c1..cdfdd3ad4 100644 --- a/packages/taucmdr/model/target.py +++ b/packages/taucmdr/model/target.py @@ -475,6 +475,7 @@ def attributes(): 'group': 'software package', 'metavar': '(||download|download-tr4|download-tr6|None)', 'action': ParsePackagePathAction}, + 'deprecated': {'download-tr4' : '2.29.1', 'download-tr6' : '2.29.1'}, 'rebuild_required': True }, 'libotf2_source': { @@ -701,6 +702,9 @@ def papi_metrics(self, event_type="PRESET", include_modifiers=False): def tau_metrics(self): return self.get_installation('tau').tau_metrics() + def tau_version(self): + return self.get_installation('tau').tau_version() + def cupti_metrics(self): if not self.get('cuda'): return [] From b42ad2e96e470a63272102ca224240b786b4218f Mon Sep 17 00:00:00 2001 From: Samuel Khuvis Date: Sun, 25 Apr 2021 09:54:53 -0700 Subject: [PATCH 3/3] Check for deprecated/removed features --- packages/taucmdr/model/experiment.py | 33 +++++++++++++++++++++++----- packages/taucmdr/model/target.py | 2 +- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/packages/taucmdr/model/experiment.py b/packages/taucmdr/model/experiment.py index a103d2653..91795bdda 100644 --- a/packages/taucmdr/model/experiment.py +++ b/packages/taucmdr/model/experiment.py @@ -250,13 +250,36 @@ def verify(self): if 'deprecated' in props: if comp.controller(self.storage).search(self.eid)[0][attr] in props['deprecated']: deprecated_option = comp.controller(self.storage).search(self.eid)[0][attr] - depr_str = props['deprecated'][targ[attr]] - depr = [int(i) for i in depr_str.split('.')] - depr.extend([0]*(3-len(depr))) - if tau_version >= depr: + dep = props['deprecated'][targ[attr]] + if isinstance(dep, list): + if len(dep) == 2 and dep[1] != '': + rem_str = dep[1] + rem = [int(i) for i in rem_str.split('.')] + rem.extend([0]*(3-len(rem))) + is_removed = tau_version >= rem + else: + is_removed = False + + if is_removed: + is_deprecated = False + else: + depr_str = dep[0] + depr = [int(i) for i in depr_str.split('.')] + depr.extend([0]*(3-len(depr))) + is_deprecated = tau_version >= depr + else: + depr_str = dep + depr = [int(i) for i in depr_str.split('.')] + depr.extend([0]*(3-len(depr))) + is_deprecated = tau_version >= depr + is_removed = False + + if is_deprecated: LOGGER.warning( - "The \"--%s %s\" has been deprecated in TAU version %s and will be removed in a future release." %(attr, deprecated_option, depr_str) + "The \"--%s %s\" option has been deprecated in TAU version %s and will be removed in a future release." %(attr, deprecated_option, depr_str) ) + elif is_removed: + raise ConfigurationError('The \"--%s %s\" option was removed in TAU version %s.' % (attr, deprecated_option, rem_str)) def on_create(self): self.verify() diff --git a/packages/taucmdr/model/target.py b/packages/taucmdr/model/target.py index cdfdd3ad4..11c46f7b1 100644 --- a/packages/taucmdr/model/target.py +++ b/packages/taucmdr/model/target.py @@ -475,7 +475,7 @@ def attributes(): 'group': 'software package', 'metavar': '(||download|download-tr4|download-tr6|None)', 'action': ParsePackagePathAction}, - 'deprecated': {'download-tr4' : '2.29.1', 'download-tr6' : '2.29.1'}, + 'deprecated': {'download-tr4' : ['2.29.1',''], 'download-tr6' : ['2.29.1','']}, 'rebuild_required': True }, 'libotf2_source': {