Skip to content
Snippets Groups Projects
Commit 3452ba06 authored by Lukáš Krupčík's avatar Lukáš Krupčík
Browse files

Merge branch 'fix_search_shortcut' into 'master'

Fixed search shortcut in matrix form

See merge request !261
parents 07bf923c 930a54f0
No related branches found
No related tags found
5 merge requests!368Update prace.md to document the change from qprace to qprod as the default...,!367Update prace.md to document the change from qprace to qprod as the default...,!366Update prace.md to document the change from qprace to qprod as the default...,!323extended-acls-storage-section,!261Fixed search shortcut in matrix form
...@@ -9,13 +9,14 @@ import re ...@@ -9,13 +9,14 @@ import re
from distutils.version import LooseVersion from distutils.version import LooseVersion
def get_data(filename): def get_data(filename):
'''function to read the data form the input csv file to use in the analysis''' '''function to read the data form the input csv file to use in the analysis'''
reader = [] # Just in case the file open fails reader = [] # Just in case the file open fails
with open(filename, 'rb') as f: with open(filename, 'rb') as f:
reader = csv.reader(f,delimiter=',') reader = csv.reader(f, delimiter=',')
#returns all the data from the csv file in list form # returns all the data from the csv file in list form
#f.close() # May need to close the file when done # f.close() # May need to close the file when done
return list(reader) # only return the reader when you have finished. return list(reader) # only return the reader when you have finished.
your_list = [] your_list = []
...@@ -28,8 +29,9 @@ your_list += get_data('./scripts/barbora.csv') ...@@ -28,8 +29,9 @@ your_list += get_data('./scripts/barbora.csv')
counts = dict() counts = dict()
for i in your_list: for i in your_list:
counts[i[0]]=counts.get(i[0], 0) + int(i[1]) counts[i[0]] = counts.get(i[0], 0) + int(i[1])
# 1 2 4 8 16 32
l = ['A', 'S', 'U', 'P', 'D', 'B'] l = ['A', 'S', 'U', 'P', 'D', 'B']
c = [] c = []
mask = ''.join(reversed(l)) mask = ''.join(reversed(l))
...@@ -49,23 +51,23 @@ versions = '' ...@@ -49,23 +51,23 @@ versions = ''
clusters = '' clusters = ''
prev = '' prev = ''
for m,i in sorted(counts.items()): for m, i in sorted(counts.items()):
#print m # print m
split = m.split('/') split = m.split('/')
#print split # print split
if len(split) > 1: if len(split) > 1:
a = split[0] a = split[0]
b = split[1] b = split[1]
if split[0] <> prev: if split[0] <> prev:
software[a] = {} software[a] = {}
software[a][b] = '`' + c[i] + '`' software[a][b] = '`' + c[i] + '`'
prev = a prev = a
packages = {} packages = {}
for m in sorted(software.items(), key=lambda i: i[0].lower()): for m in sorted(software.items(), key=lambda i: i[0].lower()):
packages[m[0]]=sorted(m[1], key=LooseVersion)[len(m[1])-1] packages[m[0]] = sorted(m[1], key=LooseVersion)[len(m[1]) - 1]
data = {'total': len(packages), 'projects': packages } data = {'total': len(packages), 'projects': packages}
print json.dumps(data) print json.dumps(data)
...@@ -8,13 +8,14 @@ import re ...@@ -8,13 +8,14 @@ import re
from distutils.version import LooseVersion from distutils.version import LooseVersion
def get_data(filename): def get_data(filename):
'''function to read the data form the input csv file to use in the analysis''' '''function to read the data form the input csv file to use in the analysis'''
reader = [] # Just in case the file open fails reader = [] # Just in case the file open fails
with open(filename, 'rb') as f: with open(filename, 'rb') as f:
reader = csv.reader(f,delimiter=',') reader = csv.reader(f, delimiter=',')
#returns all the data from the csv file in list form # returns all the data from the csv file in list form
#f.close() # May need to close the file when done # f.close() # May need to close the file when done
return list(reader) # only return the reader when you have finished. return list(reader) # only return the reader when you have finished.
your_list = [] your_list = []
...@@ -29,10 +30,11 @@ print your_list ...@@ -29,10 +30,11 @@ print your_list
counts = dict() counts = dict()
for i in your_list: for i in your_list:
#print i[0] # print i[0]
#print int(i[1]) # print int(i[1])
counts[i[0]]=counts.get(i[0], 0) + int(i[1]) counts[i[0]] = counts.get(i[0], 0) + int(i[1])
# 1 2 4 8 16 32
l = ['A', 'S', 'U', 'P', 'D', 'B'] l = ['A', 'S', 'U', 'P', 'D', 'B']
c = [] c = []
mask = ''.join(reversed(l)) mask = ''.join(reversed(l))
...@@ -59,7 +61,7 @@ print ' | +------------> DGX-2' ...@@ -59,7 +61,7 @@ print ' | +------------> DGX-2'
print ' +--------------> Barbora' print ' +--------------> Barbora'
print ' ```' print ' ```'
print print
print '| Module </br><input id="searchInput" placeholder="🔍 Filter" style="width: 8rem; border-radius: 0.2rem; color: black; padding-left: .2rem;"> | Versions | Clusters |' print '| Module </br><form><input id="searchInput" placeholder="🔍 Filter" style="width: 8rem; border-radius: 0.2rem; color: black; padding-left: .2rem;"></form> | Versions | Clusters |'
print "| ------ | -------- | -------- |" print "| ------ | -------- | -------- |"
software = dict() software = dict()
...@@ -67,26 +69,26 @@ versions = '' ...@@ -67,26 +69,26 @@ versions = ''
clusters = '' clusters = ''
prev = '' prev = ''
for m,i in sorted(counts.items()): for m, i in sorted(counts.items()):
# print m # print m
split = m.split('/') split = m.split('/')
# print split # print split
if len(split) > 1: if len(split) > 1:
a = split[0] a = split[0]
b = split[1] b = split[1]
if split[0] <> prev: if split[0] <> prev:
software[a] = {} software[a] = {}
software[a][b] = '`' + c[i] + '`' software[a][b] = '`' + c[i] + '`'
prev = a prev = a
for m in sorted(software.items(), key=lambda i: i[0].lower()): for m in sorted(software.items(), key=lambda i: i[0].lower()):
software = m[0] software = m[0]
versions = [] versions = []
clusters = [] clusters = []
for key in sorted(m[1], key=LooseVersion ): for key in sorted(m[1], key=LooseVersion):
versions.append(key) versions.append(key)
clusters.append(m[1][key]) clusters.append(m[1][key])
print "| %s | %s | %s |" % (software, '</br>'.join(versions), '</br>'.join(clusters)) print "| %s | %s | %s |" % (software, '</br>'.join(versions), '</br>'.join(clusters))
print print
print '---8<--- "modules_matrix_search.md"' print '---8<--- "modules_matrix_search.md"'
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