Skip to content
Snippets Groups Projects
Commit 1468e604 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Separate out method to read each accessor from file, so that this can be...

Separate out method to read each accessor from file, so that this can be overridden in subclasses if needed
parent b446b277
No related branches found
No related tags found
No related merge requests found
......@@ -162,16 +162,16 @@ class FileBatchRunnerClient(HttpClient):
self.message(f'Found {len(df)} input files.')
return df
def read_accs(self):
def _read(row):
try:
if row.is_multiposition:
return self.put(f'accessors/read_multiposition_file/{row.filename}', query={'lazy': True}).json()
else:
return [self.put(f'accessors/read_from_file/{row.filename}', query={'lazy': True}).json()]
except NonSuccessResponseError:
return None
def read_accessor(self, row):
try:
if row.is_multiposition:
return self.put(f'accessors/read_multiposition_file/{row.filename}', query={'lazy': True}).json()
else:
return [self.put(f'accessors/read_from_file/{row.filename}', query={'lazy': True}).json()]
except NonSuccessResponseError:
return None
def read_all_accessors(self):
accessor_ids = []
for loc_pa, df_gb in self.stacks.groupby('parent'):
pa_dir = loc_pa.relative_to(self.local_paths['input']).as_posix()
......@@ -182,7 +182,7 @@ class FileBatchRunnerClient(HttpClient):
verify=False,
make=False
)
df_gb['accessor_id'] = df_gb.apply(_read, axis=1)
df_gb['accessor_id'] = df_gb.apply(self.read_accessor, axis=1)
df_gb['position'] = df_gb['accessor_id'].apply(lambda x: range(0, len(x)))
df_gb = df_gb.explode(['accessor_id', 'position'])
accessor_ids.append(df_gb)
......@@ -249,7 +249,7 @@ class FileBatchRunnerClient(HttpClient):
def run(self):
self.restart_session()
self.verify_server()
self.read_accs()
self.read_all_accessors()
self.setup()
self.queue_tasks()
self.run_tasks()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment