Skip to content

Commit 640040c

Browse files
authored
Merge pull request #46854 from nothingface0/patch-1
[DQM] Update `compareDQMOutput.py`
2 parents bc0f2a1 + 7371cbc commit 640040c

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

DQMServices/FileIO/scripts/compareDQMOutput.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def get_file_pairs(base_dir, pr_dir):
7070
# Find intersection
7171
return [value for value in base_files if value in pr_files]
7272

73-
def upload_to_gui(output_dir, num_procs):
73+
def upload_to_gui(output_dir, num_procs, dqmgui_url):
7474
base_files = glob.glob(os.path.join(output_dir, 'base/*.root'))
7575
pr_files = glob.glob(os.path.join(output_dir, 'pr/*.root'))
7676

@@ -80,14 +80,14 @@ def upload_to_gui(output_dir, num_procs):
8080
print(files)
8181

8282
for _ in range(min(num_procs, len(files))):
83-
thread = Thread(target=upload, args=(files,))
83+
thread = Thread(target=upload, args=(files, dqmgui_url))
8484
thread.start()
8585

86-
def upload(files):
86+
def upload(files, dqmgui_url):
8787
while files:
8888
try:
8989
file = files.pop()
90-
command = ['visDQMUpload.py', 'https://cmsweb.cern.ch/dqm/dev', file]
90+
command = ['visDQMUpload.py', dqmgui_url, file]
9191
print('Uploading output:')
9292
print(' '.join(command))
9393

@@ -98,7 +98,7 @@ def upload(files):
9898
# started the loop. In this case this exception can be safely ignored.
9999
print('Exception uploading a file: %s' % ex)
100100

101-
def generate_summary_html(output_dir, pr_list, summary_dir):
101+
def generate_summary_html(output_dir, pr_list, summary_dir, dqmgui_url):
102102
template_file_path = os.path.join(os.getenv('CMSSW_BASE'), 'src', 'DQMServices', 'FileIO', 'scripts', 'dqm-histo-comparison-summary-template.html')
103103
if not os.path.isfile(template_file_path):
104104
template_file_path = os.path.join(os.getenv('CMSSW_RELEASE_BASE'), 'src', 'DQMServices', 'FileIO', 'scripts', 'dqm-histo-comparison-summary-template.html')
@@ -117,12 +117,12 @@ def generate_summary_html(output_dir, pr_list, summary_dir):
117117
overlay_count = baseline_count
118118

119119
# Make urls
120-
base_url = 'https://cmsweb.cern.ch/dqm/dev/start?runnr=%s;dataset%%3D%s;sampletype%%3Doffline_relval;workspace%%3DEverything;' % (comp['run_nr'], comp['base_dataset'])
121-
pr_url = 'https://cmsweb.cern.ch/dqm/dev/start?runnr=%s;dataset%%3D%s;sampletype%%3Doffline_relval;workspace%%3DEverything;' % (comp['run_nr'], comp['pr_dataset'])
122-
overlay_url = 'https://cmsweb.cern.ch/dqm/dev/start?runnr=%s;dataset%%3D%s;referenceshow%%3Dall;referencenorm=False;referenceobj1%%3Dother::%s::;sampletype%%3Doffline_relval;workspace%%3DEverything;' \
123-
% (comp['run_nr'], comp['pr_dataset'], comp['base_dataset'])
124-
base_raw_url = 'https://cmsweb.cern.ch/dqm/dev/jsroot/index.htm?file=https://cmsweb.cern.ch/dqm/dev/data/browse/%s' % comp['base_file_path_in_gui']
125-
pr_raw_url = 'https://cmsweb.cern.ch/dqm/dev/jsroot/index.htm?file=https://cmsweb.cern.ch/dqm/dev/data/browse/%s' % comp['pr_file_path_in_gui']
120+
base_url = '%s/start?runnr=%s;dataset%%3D%s;sampletype%%3Doffline_relval;workspace%%3DEverything;' % (dqmgui_url, comp['run_nr'], comp['base_dataset'])
121+
pr_url = '%s/start?runnr=%s;dataset%%3D%s;sampletype%%3Doffline_relval;workspace%%3DEverything;' % (dqmgui_url, comp['run_nr'], comp['pr_dataset'])
122+
overlay_url = '%s/start?runnr=%s;dataset%%3D%s;referenceshow%%3Dall;referencenorm=False;referenceobj1%%3Dother::%s::;sampletype%%3Doffline_relval;workspace%%3DEverything;' \
123+
% (dqmgui_url, comp['run_nr'], comp['pr_dataset'], comp['base_dataset'])
124+
base_raw_url = '%s/jsroot/index.htm?file=%s/data/browse/%s' % (dqmgui_url, dqmgui_url, comp['base_file_path_in_gui'])
125+
pr_raw_url = '%s/jsroot/index.htm?file=%s/data/browse/%s' % (dqmgui_url, dqmgui_url, comp['pr_file_path_in_gui'])
126126

127127
table_items += ' <tr>\n'
128128
table_items += ' <td><a href="%s" target="_blank">%s baseline GUI</a><span> (%s)</span></td>\n' % (base_url, comp['workflow'], baseline_count)
@@ -161,6 +161,7 @@ def generate_summary_html(output_dir, pr_list, summary_dir):
161161
parser.add_argument('-r', '--release-format', help='Release format in this format: CMSSW_10_5_X_2019-02-17-0000')
162162
parser.add_argument('-s', '--summary-dir', help='Directory where summary with all links will be saved', default='')
163163
parser.add_argument('-l', '--pr-list', help='A list of PRs participating in the comparison', default='')
164+
parser.add_argument('-u', '--dqmgui-url', help='DQMGUI url to upload to', default='https://cmsweb.cern.ch/dqm/dev', required=False)
164165
args = parser.parse_args()
165166

166167
# Get the number of the PR which triggered the comparison
@@ -179,5 +180,5 @@ def generate_summary_html(output_dir, pr_list, summary_dir):
179180
os._exit(1)
180181

181182
collect_and_compare_files(args.base_dir, args.pr_dir, args.output_dir, args.nprocs, pr_number, args.test_number, release_format)
182-
upload_to_gui(args.output_dir, args.nprocs)
183-
generate_summary_html(args.output_dir, args.pr_list, args.summary_dir)
183+
upload_to_gui(args.output_dir, args.nprocs, args.dqmgui_url)
184+
generate_summary_html(args.output_dir, args.pr_list, args.summary_dir, args.dqmgui_url)

0 commit comments

Comments
 (0)