Skip to content

Commit

Permalink
Merge pull request #26 from cms-DQM/dev128
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingface0 authored Jun 25, 2024
2 parents d934903 + 4690528 commit 77689a9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions bin/visDQMDeleteDaemon
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from traceback import print_exc
from Monitoring.Core.Utils.Common import logme
from urllib import request
from fcntl import lockf, LOCK_EX, LOCK_UN

from functools import cmp_to_key

# --------------------------------------------------------------------
# Command line parameters
Expand Down Expand Up @@ -235,9 +235,9 @@ while True:
return (a > b) - (a < b)

runDS.setdefault(sample["type"], {})
for tp in sorted(sample["items"], key=lambda x, y: cmp(x["run"], y["run"]))[
:-1
]:
for tp in sorted(
sample["items"], key=cmp_to_key(lambda x, y: cmp(x["run"], y["run"]))
)[:-1]:
newSample = (
runDS[tp["type"]]
.setdefault(tp["dataset"], {})
Expand Down
5 changes: 3 additions & 2 deletions bin/visDQMImportDaemon
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env python3

import os, os.path, time, sys, argparse, subprocess, functools
import os, os.path, time, sys, argparse, subprocess
from subprocess import Popen, PIPE
from traceback import print_exc
from Monitoring.Core.Utils.Common import logme
from datetime import datetime, timedelta
from glob import glob
from fcntl import lockf, LOCK_EX, LOCK_UN
from socket import getfqdn
from functools import cmp_to_key

parser = argparse.ArgumentParser(
description="Agent that imports root files "
Expand Down Expand Up @@ -399,7 +400,7 @@ while True:
# Process the files in registration order.
nfiles = 0
existing = None
for info in sorted(new, key=functools.cmp_to_key(orderFiles)):
for info in sorted(new, key=cmp_to_key(orderFiles)):
fname = "%s/%s" % (args.FILEREPO, info["path"])
finfo = "%s.dqminfo" % fname

Expand Down
6 changes: 3 additions & 3 deletions bin/visDQMReceiveDaemon
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python3

import os, os.path, time, sys, re, hashlib, functools
import os, os.path, time, sys, re, hashlib
import logging
from traceback import print_exc
from Monitoring.Core.Utils.Common import logme
from tempfile import mkstemp
from stat import *
from Monitoring.DQM import visDQMUtils

from functools import cmp_to_key

DROPBOX = sys.argv[1] # Directory where we receive input ("drop box").
FILEREPO = sys.argv[2] # Final file repository of original DQM files.
Expand Down Expand Up @@ -466,7 +466,7 @@ while True:
try:
# Find new complete files. Compute repository destination for
# each file. Reversion files where an older one already exists.
for info in sorted(findNewFiles(), key=functools.cmp_to_key(orderFiles)):
for info in sorted(findNewFiles(), key=cmp_to_key(orderFiles)):
logme("receiving %s" % info["import"])
finaliseOneFile(info)

Expand Down
6 changes: 4 additions & 2 deletions bin/visDQMZipFreezeDaemon
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from traceback import print_exc
from Monitoring.Core.Utils.Common import logme
from tempfile import mkstemp
from glob import glob

from functools import cmp_to_key

DROPBOX = sys.argv[1] # Directory where we receive input ("drop box").
ZIPREPO = sys.argv[2] # Zip file repository repository.
Expand Down Expand Up @@ -58,7 +58,9 @@ while True:
# number) to freeze list. For the most recent one, check the
# zinfo file contents to determine if the zip is old enough to
# be frozen.
zlist = sorted(new[key], key=lambda x, y: cmp(x[1], y[1]), reverse=True)
zlist = sorted(
new[key], key=cmp_to_key(lambda x, y: cmp(x[1], y[1])), reverse=True
)
for zf in zlist[1:]:
freeze.append(zf[0])

Expand Down

0 comments on commit 77689a9

Please sign in to comment.