Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit cb9caf1

Browse files
Specify sdc version from channel for examples testing (#837)
* Specify sdc version from channel for examples testing It occurs that conda resolver can take Intel SDC package not from first channel where it is found. Specify particular SDC version to avoid this in examples for now. Also print info for environment creation and package installing * Fix incerrectly used f-string * Fix log_info call
1 parent 5dd9ea0 commit cb9caf1

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

buildscripts/run_examples.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def run_examples(sdc_utils):
9090
sdc_utils.log_info('Run Intel(R) SDC examples', separate=True)
9191
sdc_utils.log_info(sdc_utils.line_double)
9292
sdc_utils.create_environment()
93-
sdc_utils.install_conda_package(['sdc'])
93+
sdc_package = f'sdc={sdc_utils.get_sdc_version_from_channel()}'
94+
sdc_utils.install_conda_package([sdc_package])
9495

9596
run_examples(sdc_utils)

buildscripts/utilities.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727

2828

29+
import json
2930
import os
3031
import platform
3132
import re
@@ -87,7 +88,7 @@ def create_environment(self, packages_list=[]):
8788
# Create Intel SDC environment
8889
create_args = ['-q', '-y', '-n', self.env_name, f'python={self.python}']
8990
create_args += packages_list + self.channel_list + ['--override-channels']
90-
self.__run_conda_command(Conda_Commands.CREATE, create_args)
91+
self.log_info(self.__run_conda_command(Conda_Commands.CREATE, create_args))
9192

9293
return
9394

@@ -97,7 +98,7 @@ def install_conda_package(self, packages_list):
9798
self.log_info(f'Install {" ".join(packages_list)} to {self.env_name} conda environment')
9899
install_args = ['-n', self.env_name]
99100
install_args += self.channel_list + ['--override-channels', '-q', '-y'] + packages_list
100-
self.__run_conda_command(Conda_Commands.INSTALL, install_args)
101+
self.log_info(self.__run_conda_command(Conda_Commands.INSTALL, install_args))
101102

102103
return
103104

@@ -135,3 +136,19 @@ def log_info(self, msg, separate=False):
135136
if separate:
136137
print(f'{time.strftime("%d/%m/%Y %H:%M:%S")}: {self.line_double}', flush=True)
137138
print(f'{time.strftime("%d/%m/%Y %H:%M:%S")}: {msg}', flush=True)
139+
140+
def get_sdc_version_from_channel(self):
141+
python_version = 'py' + self.python.replace('.', '')
142+
143+
# Get Intel SDC version from first channel in channel_list
144+
search_args = ['sdc', '-c', self.channel_list[1], '--override-channels', '--json']
145+
search_result = self.__run_conda_command(Conda_Commands.SEARCH, search_args)
146+
147+
repo_data = json.loads(search_result)
148+
for package_data in repo_data['sdc']:
149+
sdc_version = package_data['version']
150+
sdc_build = package_data['build']
151+
if python_version in sdc_build:
152+
break
153+
154+
return f'{sdc_version}={sdc_build}'

0 commit comments

Comments
 (0)