@@ -95,12 +95,15 @@ def extract_artifact_version_remote(
9595 res = execute_remote_commands (server_public_ip , username , private_key , commands )
9696 recv_exit_status , stdout , stderr = res [0 ]
9797 print (stdout )
98- version = extract_module_semver_from_info_modules_cmd (stdout )
99- return version
98+ module_name , version = extract_module_semver_from_info_modules_cmd (stdout )
99+ return module_name , version
100100
101101
102102def extract_module_semver_from_info_modules_cmd (stdout ):
103- version = None
103+ versions = []
104+ module_names = []
105+ if type (stdout ) == bytes :
106+ stdout = stdout .decode ()
104107 if type (stdout ) == str :
105108 info_modules_output = stdout .split ("\n " )[1 :]
106109 else :
@@ -114,7 +117,9 @@ def extract_module_semver_from_info_modules_cmd(stdout):
114117 logging .info (
115118 "Detected artifact={}, semver={}." .format (module_name , version )
116119 )
117- return version
120+ module_names .append (module_name )
121+ versions .append (version )
122+ return module_names , versions
118123
119124
120125def run_remote_command_logic (args ):
@@ -124,6 +129,7 @@ def run_remote_command_logic(args):
124129 tf_github_repo = args .github_repo
125130 tf_github_sha = args .github_sha
126131 tf_github_branch = args .github_branch
132+ required_modules = args .required_module
127133
128134 if tf_github_org is None :
129135 (
@@ -389,9 +395,27 @@ def run_remote_command_logic(args):
389395 remote_dataset_file ,
390396 dirname ,
391397 )
392- artifact_version = extract_artifact_version_remote (
398+ module_names , artifact_versions = extract_artifact_version_remote (
393399 server_public_ip , server_plaintext_port , username , private_key
394400 )
401+ if len (required_modules ) > 0 :
402+ logging .info (
403+ "Checking if the following required modules {} are present" .format (
404+ required_modules
405+ )
406+ )
407+ for required_module in required_modules :
408+ if required_module not in module_names :
409+ raise Exception (
410+ "Unable to detect required module {} in {}, using remote DB with IP {}, PORT {}. Aborting..." .format (
411+ required_module ,
412+ module_names ,
413+ server_public_ip ,
414+ server_plaintext_port ,
415+ )
416+ )
417+
418+ artifact_version = artifact_versions [0 ]
395419 (
396420 benchmark_min_tool_version ,
397421 benchmark_min_tool_version_major ,
0 commit comments