Skip to content

Commit 3f70bc1

Browse files
committed
Updates to @antgonza comments
1 parent 900d915 commit 3f70bc1

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

qiita_db/test/test_meta_util.py

-2
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,6 @@ def _get_daily_stats():
299299

300300
for k, exp, f in vals:
301301
redis_key = '%s:stats:%s' % (portal, k)
302-
print("here's redis", f(redis_key))
303-
print("exp:", exp)
304302
# checking redis values
305303
self.assertEqual(f(redis_key), exp)
306304
# checking DB values; note that redis stores all values as bytes,

qiita_db/test/test_util.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1316,9 +1316,8 @@ def setUp(self):
13161316
"sName", "sVersion", "cID", "cName", "processing_job_id",
13171317
"parameters", "samples", "columns", "input_size", "extra_info",
13181318
"MaxRSSRaw", "ElapsedRaw"]
1319-
self.df = pd.DataFrame(
1320-
qdb.util._retrieve_resource_data(self.CNAME, self.SNAME),
1321-
columns=self.columns)
1319+
self.df = qdb.util._retrieve_resource_data(
1320+
self.CNAME, self.SNAME, self.columns)
13221321

13231322
def test_plot_return(self):
13241323
# check the plot returns correct objects

qiita_db/util.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
from datetime import timedelta
7777
import matplotlib.pyplot as plt
7878
import numpy as np
79+
import pandas as pd
7980
from scipy.optimize import minimize
8081

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

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

23822382

2383-
def _retrieve_resource_data(cname, sname):
2383+
def _retrieve_resource_data(cname, sname, columns):
23842384
with qdb.sql_connection.TRN:
23852385
sql = """
23862386
SELECT
@@ -2411,8 +2411,8 @@ def _retrieve_resource_data(cname, sname):
24112411
"""
24122412
qdb.sql_connection.TRN.add(sql, sql_args=[cname, sname])
24132413
res = qdb.sql_connection.TRN.execute_fetchindex()
2414-
return res
2415-
pass
2414+
df = pd.DataFrame(res, columns=columns)
2415+
return df
24162416

24172417

24182418
def _resource_allocation_plot_helper(

0 commit comments

Comments
 (0)