Skip to content

Commit 43e1463

Browse files
committed
Update meta_util.py
1 parent c9ce88b commit 43e1463

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

qiita_db/meta_util.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ def update_resource_allocation_redis(active=True, verbose=False):
564564
Defaults to True. Should only be False when testing.
565565
566566
verbose: boolean, optional
567-
Defaults to False. Prints status on what functin
567+
Defaults to False. Prints status on what function
568568
569569
"""
570570
time = datetime.now().strftime('%m-%d-%y')
@@ -573,7 +573,7 @@ def update_resource_allocation_redis(active=True, verbose=False):
573573
with qdb.sql_connection.TRN:
574574
sql = 'SELECT col_name FROM qiita.resource_allocation_column_names;'
575575
qdb.sql_connection.TRN.add(sql)
576-
col_names_list = qdb.sql_connection.TRN.execute_fetchflatten()
576+
col_names = qdb.sql_connection.TRN.execute_fetchflatten()
577577

578578
# Retreave available software
579579
software_list = list(qdb.software.Software.iter(active=active))
@@ -590,14 +590,14 @@ def update_resource_allocation_redis(active=True, verbose=False):
590590

591591
for command in software.commands:
592592
cmd_name = command.name
593-
scommands[sname][sversion][cmd_name] = col_names_list
593+
scommands[sname][sversion][cmd_name] = col_names
594594

595595
redis_key = 'resources:commands'
596596
r_client.set(redis_key, str(scommands))
597597

598598
for sname, versions in scommands.items():
599599
for version, commands in versions.items():
600-
for cname, col_name_list in commands.items():
600+
for cname, col_names in commands.items():
601601
df = retrieve_resource_data(cname, sname, version, COLUMNS)
602602
if verbose:
603603
print(("Retrieving allocation resources for " +
@@ -612,9 +612,9 @@ def update_resource_allocation_redis(active=True, verbose=False):
612612
f" command: {cname}"))
613613
continue
614614
# column_name_str looks like col1*col2*col3, etc
615-
for col_name_str in col_name_list:
615+
for col_name in col_names:
616616
new_column = None
617-
col_name_split = col_name_str.split('*')
617+
col_name_split = col_name.split('*')
618618
df_copy = df.dropna(subset=col_name_split)
619619

620620
# Create a column with the desired columns
@@ -628,10 +628,10 @@ def update_resource_allocation_redis(active=True, verbose=False):
628628
f" software: {sname}" +
629629
f" version: {version}" +
630630
f" command: {cname}" +
631-
f" column name: {col_name_str}"))
631+
f" column name: {col_name}"))
632632

633633
fig, axs = resource_allocation_plot(df_copy,
634-
col_name_str,
634+
col_name,
635635
new_column,
636636
verbose=verbose)
637637
titles = [0, 0]
@@ -689,10 +689,10 @@ def update_resource_allocation_redis(active=True, verbose=False):
689689
f" software: {sname}" +
690690
f" version: {version}" +
691691
f" command: {cname}" +
692-
f" column name: {col_name_str}"))
692+
f" column name: {col_name}"))
693693

694694
for k, v, f in values:
695695
redis_key = 'resources$#%s$#%s$#%s$#%s:%s' % (
696-
cname, sname, version, col_name_str, k)
696+
cname, sname, version, col_name, k)
697697
r_client.delete(redis_key)
698698
f(redis_key, v)

0 commit comments

Comments
 (0)