Skip to content
Snippets Groups Projects

[RTADPA BW tests] Test feasibility of copying HLT2 output to read into sprucing test

Merged Ross John Hunter requested to merge rjhunter-chained-test-feasibility into master
1 file
+ 14
15
Compare changes
  • Side-by-side
  • Inline
@@ -29,43 +29,42 @@ FALLBACK_CACHE_DIR = os.getenv('XDG_RUNTIME_DIR', tempfile.gettempdir())
FILE_TO_COPY = "mdf:root://eoslhcb.cern.ch//eos/lhcb/storage/lhcbpr/www/UpgradeRateTest/hlt2_bw_testing__production__full.mdf"
def default_cache_dirs():
hostname = socket.getfqdn()
dirs = DEFAULT_CACHE_DIRS.get(hostname, DEFAULT_CACHE_DIRS['default'])
return dirs
def main():
logging.basicConfig(
format='%(levelname)-7s %(message)s',
level=logging.INFO)
format='%(levelname)-7s %(message)s', level=logging.INFO)
cache_dir = default_cache_dirs()
if not os.path.isdir(cache_dir):
fallback_dir = tempfile.mkdtemp(
prefix='bandwidth-', dir=FALLBACK_CACHE_DIR)
logging.warning(
'default cache dir {!r} doesnt exist, using {}'.format(
cache_dir, fallback_dir))
logging.warning('default cache dir {!r} doesnt exist, using {}'.format(
cache_dir, fallback_dir))
cache_dir = fallback_dir
# if we use the fallback directory, clean up after ourselves
atexit.register(shutil.rmtree, fallback_dir)
# Now download file
logging.info(
f'Downloading input file {FILE_TO_COPY}'
)
logging.info(f'Downloading input file {FILE_TO_COPY}')
# download_mdf_inputs_locally only downloads if files
# are not already available locally on the machine
logging.info(
f'Downloading inputs for bandwidth job to {cache_dir}')
logging.info(f'Downloading inputs for bandwidth job to {cache_dir}')
before_copy = datetime.now()
kB_to_GB = 1e3
downloaded_path = download_mdf_inputs_locally(
[FILE_TO_COPY],
cache_dir,
max_size=300 * kB_to_GB * 2e4) # Guesses as to output size and n_events in the FULL stream TODO improve
logging.info(f"Downloaded {downloaded_path}. This took: {datetime.now() - before_copy}")
[FILE_TO_COPY], cache_dir, max_size=300 * kB_to_GB * 2e4
) # Guesses as to output size and n_events in the FULL stream TODO improve
logging.info(
f"Downloaded {downloaded_path}. This took: {datetime.now() - before_copy}"
)
if __name__ == "__main__":
main()
\ No newline at end of file
main()
Loading