Skip to content

Commit

Permalink
Updates to @antgonza comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Gossty committed May 16, 2024
1 parent 900d915 commit 3f70bc1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 0 additions & 2 deletions qiita_db/test/test_meta_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,6 @@ def _get_daily_stats():

for k, exp, f in vals:
redis_key = '%s:stats:%s' % (portal, k)
print("here's redis", f(redis_key))
print("exp:", exp)
# checking redis values
self.assertEqual(f(redis_key), exp)
# checking DB values; note that redis stores all values as bytes,
Expand Down
5 changes: 2 additions & 3 deletions qiita_db/test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,9 +1316,8 @@ def setUp(self):
"sName", "sVersion", "cID", "cName", "processing_job_id",
"parameters", "samples", "columns", "input_size", "extra_info",
"MaxRSSRaw", "ElapsedRaw"]
self.df = pd.DataFrame(
qdb.util._retrieve_resource_data(self.CNAME, self.SNAME),
columns=self.columns)
self.df = qdb.util._retrieve_resource_data(
self.CNAME, self.SNAME, self.columns)

def test_plot_return(self):
# check the plot returns correct objects
Expand Down
8 changes: 4 additions & 4 deletions qiita_db/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
from datetime import timedelta
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.optimize import minimize

# memory constant functions defined for @resource_allocation_plot
Expand Down Expand Up @@ -2360,7 +2361,6 @@ def resource_allocation_plot(df, cname, sname, col_name):
Returns a matplotlib object with a plot
"""

# df = df[(df.cName == cname) & (df.sName == sname)]
df.dropna(subset=['samples', 'columns'], inplace=True)
df[col_name] = df.samples * df['columns']
df[col_name] = df[col_name].astype(int)
Expand All @@ -2380,7 +2380,7 @@ def resource_allocation_plot(df, cname, sname, col_name):
return fig, axs


def _retrieve_resource_data(cname, sname):
def _retrieve_resource_data(cname, sname, columns):
with qdb.sql_connection.TRN:
sql = """
SELECT
Expand Down Expand Up @@ -2411,8 +2411,8 @@ def _retrieve_resource_data(cname, sname):
"""
qdb.sql_connection.TRN.add(sql, sql_args=[cname, sname])
res = qdb.sql_connection.TRN.execute_fetchindex()
return res
pass
df = pd.DataFrame(res, columns=columns)
return df


def _resource_allocation_plot_helper(
Expand Down

0 comments on commit 3f70bc1

Please sign in to comment.