removing useless lines from ecg

This commit is contained in:
Quentin Guilloteau 2024-08-28 14:37:00 +02:00
parent 025a16b62c
commit 258cd64e40

33
ecg.py
View File

@ -205,9 +205,6 @@ def buildresult_saver(result, buildstatus_path, config_path):
""" """
buildstatus_file = open(buildstatus_path, "a") buildstatus_file = open(buildstatus_path, "a")
artifact_name = os.path.basename(config_path).split(".")[0] artifact_name = os.path.basename(config_path).split(".")[0]
# # Writing header in case file didn't exist:
# if not file_exists:
# buildstatus_file.write("yaml_path,timestamp,error")
now = datetime.datetime.now() now = datetime.datetime.now()
timestamp = str(datetime.datetime.timestamp(now)) timestamp = str(datetime.datetime.timestamp(now))
buildstatus_file.write(f"{artifact_name},{timestamp},{result}\n") buildstatus_file.write(f"{artifact_name},{timestamp},{result}\n")
@ -386,11 +383,6 @@ def main():
It is meant to be executed periodically to analyze variations in the software environment of the artifact through time. It is meant to be executed periodically to analyze variations in the software environment of the artifact through time.
""" """
) )
# parser.add_argument(
# '-v', '--verbose',
# action = 'store_true',
# help = "Shows more details on what is being done."
# )
parser.add_argument( parser.add_argument(
"config", "config",
help = "The path to the configuration file of the artifact's Docker image." help = "The path to the configuration file of the artifact's Docker image."
@ -400,11 +392,6 @@ def main():
help = "Path to the file where the package list generated by the program should be written.", help = "Path to the file where the package list generated by the program should be written.",
required = True required = True
) )
# parser.add_argument(
# "-l", "--log-path",
# help = "Path to the file where to log the output of the program.",
# required = True
# )
parser.add_argument( parser.add_argument(
"-b", "--build-status", "-b", "--build-status",
help = "Path to the file where to write the build status of the Docker image given in the configuration file.", help = "Path to the file where to write the build status of the Docker image given in the configuration file.",
@ -424,11 +411,6 @@ def main():
""", """,
required = False required = False
), ),
parser.add_argument(
'--docker-cache',
action = 'store_true',
help = "Use cache for Docker 'build'."
)
args = parser.parse_args() args = parser.parse_args()
# Setting up the paths of the outputs: # Setting up the paths of the outputs:
@ -436,8 +418,6 @@ def main():
buildstatus_path = args.build_status buildstatus_path = args.build_status
arthashlog_path = args.artifact_hash arthashlog_path = args.artifact_hash
cache_dir = args.cache_dir cache_dir = args.cache_dir
# log_path = "log.txt" # Output of the program
# log_path = args.log_path
# Creating the output files to avoid complaints from Snakemake about missing # Creating the output files to avoid complaints from Snakemake about missing
# outputs... # outputs...
@ -447,11 +427,6 @@ def main():
# Setting up the log: # Setting up the log:
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
# # Old version where the script writes its own log to the given file:
# print(f"Output will be stored in {log_path}")
# logging.basicConfig(filename = log_path, filemode = "w", format = '%(levelname)s: %(message)s', level = logging.INFO)
# if args.verbose:
# logging.getLogger().addHandler(logging.StreamHandler(sys.stdout))
# Parsing the input file including the configuration of the artifact's # Parsing the input file including the configuration of the artifact's
# image: # image:
@ -486,14 +461,6 @@ def main():
else: else:
logging.fatal("Artifact could not be downloaded!") logging.fatal("Artifact could not be downloaded!")
status = "artifact_unavailable" status = "artifact_unavailable"
# except Exception as err:
# # Handles any possible script's own crashes:
# formatted_err = str(''.join(traceback.format_exception(None, err, err.__traceback__)))
# log_file = open(log_path, "a")
# log_file.write(formatted_err)
# log_file.close()
# logging.error(formatted_err)
# status = "script_crash"
buildresult_saver(status, buildstatus_path, config_path) buildresult_saver(status, buildstatus_path, config_path)
if __name__ == "__main__": if __name__ == "__main__":