Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def is_program_new_enough(program, version_feature_introduced):
"""Returns True if `program` registered in QCEngine, locatable in
environment, has parseable version, and that version in normalized
form is equal to or later than `version_feature_introduced`.
"""
if program not in qcng.list_available_programs():
return False
candidate_version = qcng.get_program(program).get_version()
return parse_version(candidate_version) >= parse_version(version_feature_introduced)
# Server response/stale job handling
self.server_error_retries = server_error_retries
self.stale_update_limit = stale_update_limit
self._stale_updates_tracked = 0
self._stale_payload_tracking = []
self.n_stale_jobs = 0
# QCEngine data
self.available_programs = qcng.list_available_programs()
self.available_procedures = qcng.list_available_procedures()
# Display a warning if there are non-node-parallel programs and >1 node_per_task
if self.nodes_per_task > 1:
for name in self.available_programs:
program = qcng.get_program(name)
if not program.node_parallel:
self.logger.warning(
"Program {} is not node parallel," " but manager will use >1 node per task".format(name)
)
# Print out configuration
self.logger.info("QueueManager:")
self.logger.info(" Version: {}\n".format(get_information("version")))
if self.verbose:
self.logger.info(" Name Information:")
self.logger.info(" Cluster: {}".format(self.name_data["cluster"]))
self.logger.info(" Hostname: {}".format(self.name_data["hostname"]))
self.logger.info(" UUID: {}\n".format(self.name_data["uuid"]))
self.logger.info(" Queue Adapter:")
def info_programs(): # lgtm: [py/similar-function]
print(">>> Program information")
all_progs = list_all_programs()
avail_progs = list_available_programs()
print("Available programs:")
for prog_name in sorted(avail_progs):
version = get_program(prog_name).get_version()
if version is None:
version = "???"
print(f"{prog_name + ':':12} v{version}")
print()
print("Other supported programs:")
print(" ".join(sorted(all_progs - avail_progs)))
print()
print(
"""If you think available programs are missing, query for details: `python -c "import qcengine as qcng; qcng.get_program('')"`"""
)
print()