Skip to content

Commit

Permalink
Flynt updates, some manual
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Nilsson committed Nov 7, 2023
1 parent e9b6207 commit e95557a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 63 deletions.
104 changes: 52 additions & 52 deletions pilot/test/test_esstager.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ def test_stageout_es_events(self):
kwargs = dict(workdir=workdir, cwd=workdir, usecontainer=False)
client.prepare_destinations(xdata, activity='es_events')
client.transfer(xdata, activity='es_events', **kwargs)
except exception.PilotException as error: # Python 2/3
logger.error("Pilot Exception: %s, %s" % (error.get_detail(), traceback.format_exc()))
except Exception as e: # Python 2/3
except exception.PilotException as error:
logger.error(f"Pilot Exception: {error.get_detail()}, {traceback.format_exc()}")
except Exception as exc:
logger.error(traceback.format_exc())
error = exception.StageOutFailure("stageOut failed with error=%s" % e)
error = exception.StageOutFailure(f"stageOut failed with error={exc}")
else:
logger.info('Summary of transferred files:')
for e in xdata:
logger.info(" -- lfn=%s, status_code=%s, status=%s" % (e.lfn, e.status_code, e.status))
logger.info(f" -- lfn={e.lfn}, status_code={e.status_code}, status={e.status}")

if error:
logger.error('Failed to stage-out eventservice file(%s): error=%s' % (output_file, error.get_detail()))
logger.error(f'Failed to stage-out eventservice file({output_file}): error={error.get_detail()}')
raise error

@unittest.skipIf(not check_env(), "No CVMFS")
Expand Down Expand Up @@ -131,18 +131,18 @@ def test_stageout_es_events_pw(self):
kwargs = dict(workdir=workdir, cwd=workdir, usecontainer=False)
client.prepare_destinations(xdata, activity=['es_events', 'pw']) # allow to write to `es_events` and `pw` astorages
client.transfer(xdata, activity=['es_events', 'pw'], **kwargs)
except exception.PilotException as error: # Python 2/3
logger.error("Pilot Exeception: %s, %s" % (error.get_detail(), traceback.format_exc()))
except Exception as e: # Python 2/3
except exception.PilotException as error:
logger.error(f"Pilot Exeception: {error.get_detail()}, {traceback.format_exc()}")
except Exception as exc:
logger.error(traceback.format_exc())
error = exception.StageOutFailure("stageOut failed with error=%s" % e)
error = exception.StageOutFailure(f"stageOut failed with error={exc}")
else:
logger.info('Summary of transferred files:')
for e in xdata:
logger.info(" -- lfn=%s, status_code=%s, status=%s" % (e.lfn, e.status_code, e.status))
for fil in xdata:
logger.info(f" -- lfn={fil.lfn}, status_code={fil.status_code}, status={fil.status}")

if error:
logger.error('Failed to stage-out eventservice file(%s): error=%s' % (output_file, error.get_detail()))
logger.error(f'Failed to stage-out eventservice file({output_file}): error={error.get_detail()}')
raise error

@unittest.skipIf(not check_env(), "No CVMFS")
Expand Down Expand Up @@ -174,18 +174,18 @@ def test_stageout_es_events_non_exist_pw(self):
kwargs = dict(workdir=workdir, cwd=workdir, usecontainer=False)
client.prepare_destinations(xdata, activity=['es_events_non_exist', 'pw']) # allow to write to `es_events_non_exist` and `pw` astorages
client.transfer(xdata, activity=['es_events_non_exist', 'pw'], **kwargs)
except exception.PilotException as error: # Python 2/3
logger.error("Pilot Exeception: %s, %s" % (error.get_detail(), traceback.format_exc()))
except Exception as e: # Python 2/3
except exception.PilotException as error:
logger.error(f"Pilot Exeception: {error.get_detail()}, {traceback.format_exc()}")
except Exception as exc:
logger.error(traceback.format_exc())
error = exception.StageOutFailure("stageOut failed with error=%s" % e)
error = exception.StageOutFailure(f"stageOut failed with error={exc}")
else:
logger.info('Summary of transferred files:')
for e in xdata:
logger.info(" -- lfn=%s, status_code=%s, status=%s" % (e.lfn, e.status_code, e.status))
for fil in xdata:
logger.info(f" -- lfn={fil.lfn}, status_code={fil.status_code}, status={fil.status}")

if error:
logger.error('Failed to stage-out eventservice file(%s): error=%s' % (output_file, error.get_detail()))
logger.error(f'Failed to stage-out eventservice file({output_file}): error={error.get_detail()}')
raise error

@unittest.skipIf(not check_env(), "No CVMFS")
Expand Down Expand Up @@ -217,26 +217,26 @@ def test_stageout_stagein(self):
kwargs = dict(workdir=workdir, cwd=workdir, usecontainer=False)
client.prepare_destinations(xdata, activity=['es_events', 'pw']) # allow to write to `es_events` and `pw` astorages
client.transfer(xdata, activity=['es_events', 'pw'], **kwargs)
except exception.PilotException as error: # Python 2/3
logger.error("Pilot Exeception: %s, %s" % (error.get_detail(), traceback.format_exc()))
except Exception as e: # Python 2/3
except exception.PilotException as error:
logger.error(f"Pilot Exeception: {error.get_detail()}, {traceback.format_exc()}")
except Exception as exc:
logger.error(traceback.format_exc())
error = exception.StageOutFailure("stageOut failed with error=%s" % e)
error = exception.StageOutFailure(f"stageOut failed with error={exc}")
else:
logger.info('Summary of transferred files:')
for e in xdata:
logger.info(" -- lfn=%s, status_code=%s, status=%s" % (e.lfn, e.status_code, e.status))
for fil in xdata:
logger.info(f" -- lfn={fil.lfn}, status_code={fil.status_code}, status={fil.status}")

if error:
logger.error('Failed to stage-out eventservice file(%s): error=%s' % (output_file, error.get_detail()))
logger.error(f'Failed to stage-out eventservice file({output_file}): error={error.get_detail()}')
raise error

storage_id = infosys.get_storage_id(file_spec.ddmendpoint)
logger.info('File %s staged out to %s(id: %s)' % (file_spec.lfn, file_spec.ddmendpoint, storage_id))
logger.info(f'File {file_spec.lfn} staged out to {file_spec.ddmendpoint}(id: {storage_id})')

new_file_data = {'scope': 'test',
'lfn': file_spec.lfn,
'storage_token': '%s/1000' % storage_id}
'storage_token': f'{storage_id}/1000'}
try:
new_file_spec = FileSpec(filetype='input', **new_file_data)

Expand All @@ -246,18 +246,18 @@ def test_stageout_stagein(self):
kwargs = dict(workdir=workdir, cwd=workdir, usecontainer=False)
client.prepare_sources(xdata)
client.transfer(xdata, activity=['es_events_read'], **kwargs)
except exception.PilotException as error: # Python 2/3
logger.error("Pilot Exeception: %s, %s" % (error.get_detail(), traceback.format_exc()))
except Exception as e: # Python 2/3
except exception.PilotException as error:
logger.error(f"Pilot Exeception: {error.get_detail()}, {traceback.format_exc()}")
except Exception as exc:
logger.error(traceback.format_exc())
error = exception.StageInFailure("stagein failed with error=%s" % e)
error = exception.StageInFailure(f"stagein failed with error={exc}")
else:
logger.info('Summary of transferred files:')
for e in xdata:
logger.info(" -- lfn=%s, status_code=%s, status=%s" % (e.lfn, e.status_code, e.status))
for fil in xdata:
logger.info(f" -- lfn={fil.lfn}, status_code={fil.status_code}, status={fil.status}")

if error:
logger.error('Failed to stage-in eventservice file(%s): error=%s' % (output_file, error.get_detail()))
logger.error(f'Failed to stage-in eventservice file({output_file}): error={error.get_detail()}')
raise error

@unittest.skipIf(not check_env(), "No CVMFS")
Expand Down Expand Up @@ -289,26 +289,26 @@ def test_stageout_noexist_activity_stagein(self):
kwargs = dict(workdir=workdir, cwd=workdir, usecontainer=False)
client.prepare_destinations(xdata, activity=['es_events_no_exist', 'pw']) # allow to write to `es_events_no_exist` and `pw` astorages
client.transfer(xdata, activity=['es_events_no_exist', 'pw'], **kwargs)
except exception.PilotException as error: # Python 2/3
logger.error("Pilot Exeception: %s, %s" % (error.get_detail(), traceback.format_exc()))
except Exception as e: # Python 2/3
except exception.PilotException as error:
logger.error(f"Pilot Exeception: {error.get_detail()}, {traceback.format_exc()}")
except Exception as exc:
logger.error(traceback.format_exc())
error = exception.StageOutFailure("stageOut failed with error=%s" % e)
error = exception.StageOutFailure(f"stageOut failed with error={exc}")
else:
logger.info('Summary of transferred files:')
for e in xdata:
logger.info(" -- lfn=%s, status_code=%s, status=%s" % (e.lfn, e.status_code, e.status))
for fil in xdata:
logger.info(f" -- lfn={fil.lfn}, status_code={fil.status_code}, status={fil.status}")

if error:
logger.error('Failed to stage-out eventservice file(%s): error=%s' % (output_file, error.get_detail()))
logger.error(f'Failed to stage-out eventservice file({output_file}): error={error.get_detail()}')
raise error

storage_id = infosys.get_storage_id(file_spec.ddmendpoint)
logger.info('File %s staged out to %s(id: %s)' % (file_spec.lfn, file_spec.ddmendpoint, storage_id))
logger.info(f'File {file_spec.lfn} staged out to {file_spec.ddmendpoint}(id: {storage_id})')

new_file_data = {'scope': 'test',
'lfn': file_spec.lfn,
'storage_token': '%s/1000' % storage_id}
'storage_token': f'{storage_id}/1000'}
try:
new_file_spec = FileSpec(filetype='input', **new_file_data)

Expand All @@ -318,16 +318,16 @@ def test_stageout_noexist_activity_stagein(self):
kwargs = dict(workdir=workdir, cwd=workdir, usecontainer=False)
client.prepare_sources(xdata)
client.transfer(xdata, activity=['es_events_read'], **kwargs)
except exception.PilotException as error: # Python 2/3
logger.error("Pilot Exeception: %s, %s" % (error.get_detail(), traceback.format_exc()))
except Exception as e: # Python 2/3
except exception.PilotException as error:
logger.error(f"Pilot Exeception: {error.get_detail()}, {traceback.format_exc()}")
except Exception as exc:
logger.error(traceback.format_exc())
error = exception.StageInFailure("stagein failed with error=%s" % e)
error = exception.StageInFailure(f"stagein failed with error={exc}")
else:
logger.info('Summary of transferred files:')
for e in xdata:
logger.info(" -- lfn=%s, status_code=%s, status=%s" % (e.lfn, e.status_code, e.status))
for fil in xdata:
logger.info(f" -- lfn={fil.lfn}, status_code={fil.status_code}, status={fil.status}")

if error:
logger.error('Failed to stage-in eventservice file(%s): error=%s' % (output_file, error.get_detail()))
logger.error(f'Failed to stage-in eventservice file({output_file}): error={error.get_detail()}')
raise error
22 changes: 11 additions & 11 deletions pilot/test/test_esworkexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,20 @@ def setUpClass(cls):

# get the payload command from the user specific code
pilot_user = os.environ.get('PILOT_USER', 'atlas').lower()
user = __import__('pilot.user.%s.common' % pilot_user, globals(), locals(), [pilot_user], 0) # Python 2/3
user = __import__(f'pilot.user.{pilot_user}.common', globals(), locals(), [pilot_user], 0)
cmd = user.get_payload_command(job)
logger.info("payload execution command: %s" % cmd)
logger.info(f"payload execution command: {cmd}")

payload = {'executable': cmd,
'workdir': job.workdir,
'output_file': 'pilot_test_%s_stdout.txt' % job['PandaID'],
'error_file': 'pilot_test_%s_stderr.txt' % job['PandaID'],
'output_file': f"pilot_test_{job['PandaID']}_stdout.txt",
'error_file': f"pilot_test_{job['PandaID']}_stderr.txt",
'job': job}
cls._payload = payload
except Exception as ex:
except Exception as exc:
if cls._communicator_manager:
cls._communicator_manager.stop()
raise ex
raise exc

@classmethod
def tearDownClass(cls):
Expand Down Expand Up @@ -161,13 +161,13 @@ def test_workexecutor_generic(self):
time.sleep(0.1)
exit_code = executor.get_exit_code()
self.assertEqual(exit_code, 0)
except Exception as ex:
logger.debug("Exception: %s, %s" % (ex, traceback.format_exc()))
except Exception as exc:
logger.debug(f"Exception: {exc}, {traceback.format_exc()}")
if self.executor:
self.executor.stop()
while self.executor.is_alive():
time.sleep(0.1)
raise ex
raise exc

@unittest.skipIf(True, "skip it")
def test_workexecutor_update_events(self):
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_workexecutor_update_events(self):
logger.debug(ret)

executor.stop()
except Exception as ex:
except Exception as exc:
if self.executor:
self.executor.stop()
raise ex
raise exc

0 comments on commit e95557a

Please sign in to comment.