Skip to content

Commit

Permalink
Repocleaner : improve some output (#2491)
Browse files Browse the repository at this point in the history
* - improve the output of the rule skip and the printing of Versions

* Do not store last execution if we ignored it.
  • Loading branch information
Barthelemy authored Jan 7, 2025
1 parent 7b6a2f2 commit 11c4ced
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Framework/script/RepoCleaner/qcrepocleaner/Ccdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def __init__(self, path: str, validFrom, validTo, createdAt, uuid=None, metadata
def __repr__(self):
if "Run" in self.metadata or "RunNumber" in self.metadata:
run_number = self.metadata["Run"] if "Run" in self.metadata else self.metadata["RunNumber"]
return f"Version of object {self.path} valid from {self.validFromAsDt}, run {run_number} (uuid {self.uuid})"
return f"Version of object {self.path} created at {self.createdAtDt.strftime('%Y-%m-%d %H:%M:%S')}, valid from {self.validFromAsDt.strftime('%Y-%m-%d %H:%M:%S')}, run {run_number} (uuid {self.uuid})"
else:
return f"Version of object {self.path} valid from {self.validFromAsDt} (uuid {self.uuid}, " \
return f"Version of object {self.path} created at {self.createdAtDt.strftime('%Y-%m-%d %H:%M:%S')}, valid from {self.validFromAsDt.strftime('%Y-%m-%d %H:%M:%S')} (uuid {self.uuid}, " \
f"ts {self.validFrom})"


Expand Down
4 changes: 2 additions & 2 deletions Framework/script/RepoCleaner/qcrepocleaner/o2-qc-repo-cleaner
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def downloadConfigFromConsul(consul_url: str, consul_port: str, file_name: str):
:return: the path to the config file
"""

logging.debug("Get it from consul")
logging.debug(f"Download config file from consul : {consul_url} {consul_port} {file_name}")
consul_server = consul.Consul(host=consul_url, port=consul_port)
file_path = 'o2/components/qc/ANY/any/' + file_name
index, data = consul_server.kv.get(key=file_path)
Expand Down Expand Up @@ -393,7 +393,7 @@ def run(args, ccdb_url, rules):
logging.info(f" *** DONE *** (total deleted: {ccdb.counter_deleted}, total updated: {ccdb.counter_validity_updated})")
message = datetime.today().strftime('%Y-%m-%d-%H:%M:%S')
storeCrucialLog(message + f" - End of the cleaner (total deleted: {ccdb.counter_deleted}, total updated: {ccdb.counter_validity_updated})")
if not args.dry_run:
if not args.dry_run and not args.ignore_last_execution:
storeSavedTimestamp()

# ****************
Expand Down
6 changes: 4 additions & 2 deletions Framework/script/RepoCleaner/qcrepocleaner/rules/skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ def process(ccdb: Ccdb, object_path: str, delay: int, from_timestamp: int, to_t
'''

logger.debug(f"Plugin 'skip' processing {object_path}")

return {"deleted" : 0, "preserved": 0}

versions = ccdb.getVersionsList(object_path)

return {"deleted": 0, "preserved": len(versions), "updated": 0}


def main():
Expand Down

0 comments on commit 11c4ced

Please sign in to comment.