37
37
from re import sub
38
38
from json import loads , dump , dumps
39
39
40
- from qiita_db .util import create_nested_path , _retrieve_resource_data
40
+ from qiita_db .util import create_nested_path , retrieve_resource_data
41
41
from qiita_db .util import resource_allocation_plot
42
42
from qiita_core .qiita_settings import qiita_config , r_client
43
43
from qiita_core .configuration_manager import ConfigurationManager
44
44
import qiita_db as qdb
45
45
46
46
# global constant list used in resource_allocation_page
47
- columns = [
47
+ COLUMNS = [
48
48
"sName" , "sVersion" , "cID" , "cName" , "processing_job_id" ,
49
49
"parameters" , "samples" , "columns" , "input_size" , "extra_info" ,
50
50
"MaxRSSRaw" , "ElapsedRaw" , "Start" , "node_name" , "node_model" ]
@@ -557,18 +557,17 @@ def generate_plugin_releases():
557
557
558
558
def get_software_commands (active ):
559
559
software_list = [s for s in qdb .software .Software .iter (active = active )]
560
- software_commands = dict ()
560
+ software_commands = defaultdict (lambda : defaultdict (list ))
561
+
561
562
for software in software_list :
562
563
sname = software .name
563
564
sversion = software .version
564
565
commands = software .commands
565
- if sname not in software_commands :
566
- software_commands [sname ] = {}
567
- if sversion not in software_commands [sname ]:
568
- software_commands [sname ][sversion ] = []
566
+
569
567
for command in commands :
570
568
software_commands [sname ][sversion ].append (command .name )
571
- return software_commands
569
+
570
+ return dict (software_commands )
572
571
573
572
574
573
def update_resource_allocation_redis (active = True ):
@@ -590,7 +589,7 @@ def update_resource_allocation_redis(active=True):
590
589
for cname in commands :
591
590
592
591
col_name = "samples * columns"
593
- df = _retrieve_resource_data (cname , sname , version , columns )
592
+ df = retrieve_resource_data (cname , sname , version , COLUMNS )
594
593
if len (df ) == 0 :
595
594
continue
596
595
0 commit comments