Skip to content

Commit 855db4f

Browse files
committedAug 11, 2017
* update to modern socket-io (essentially same as yadage-service)
1 parent ea6fd4a commit 855db4f

16 files changed

+687
-346
lines changed
 

‎Dockerfile

+3-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN pip install redis \
1717
requests \
1818
celery \
1919
packaging appdirs \
20-
ipython
20+
ipython==5.4
2121

2222
RUN pip install PyColorizer \
2323
prettytable \
@@ -33,6 +33,7 @@ RUN pip install Flask-SQLAlchemy oauth2 cryptography \
3333
# Add sources to `code` and work there:
3434
WORKDIR /code
3535

36+
RUN curl -sSL https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 -o /usr/bin/jq && chmod +x /usr/bin/jq
3637
RUN apt-get update
3738
RUN curl --silent --location https://deb.nodesource.com/setup_6.x | bash -
3839
RUN apt-get install -y nodejs
@@ -44,10 +45,7 @@ ADD . /code
4445

4546
EXPOSE 8000
4647

47-
RUN echo wha11
4848
# Install recast:
49-
RUN echo bust
50-
RUN curl -sSL https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 -o /usr/bin/jq && chmod +x /usr/bin/jq
5149
RUN cat recastcontrolcenter/.bowerrc | jq '.allow_root = true' > newbower; mv newbower recastcontrolcenter/.bowerrc
5250
RUN cd recastcontrolcenter; bower install
53-
RUN pip install --process-dependency-links .
51+
RUN pip install --process-dependency-links -e.

‎recastcontrolcenter/admin/recastadmin.py

+12-14
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
from gevent import monkey
44
monkey.patch_all()
55

6-
from recastdb.models import db
7-
from recastcontrolcenter.server import create_app
86
import click
9-
import IPython
7+
import json
8+
import os
109

1110

1211
@click.group()
@@ -15,14 +14,13 @@ def recastadmin():
1514

1615

1716
@recastadmin.command()
18-
@click.option('--config', default=None)
19-
def create_db(config):
20-
db.create_all(app=create_app(config))
21-
22-
23-
@recastadmin.command()
24-
def db_shell():
25-
import recastdb.models as models
26-
print dir(models)
27-
with create_app().app_context():
28-
IPython.embed()
17+
@click.option('-c','--config', default=None)
18+
def rebuild_catalogue(config):
19+
if config:
20+
os.environ['RECASTCONTROLCENTER_CONFIG'] = config
21+
from recastcontrolcenter.recastconfig import config
22+
from recastbackend.catalogue import build_catalogue
23+
catalogue_file = config['RECAST_CATALOGUE_FILE']
24+
catalogue_data = build_catalogue()
25+
json.dump(catalogue_data,open(catalogue_file,'w'))
26+
click.secho('wrote catalogue to {}'.format(catalogue_file), fg = 'green')

‎recastcontrolcenter/recast_interface_blueprint.py

+43-25
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@
99
import logging
1010
log = logging.getLogger(__name__)
1111

12-
1312
import recastapi.request.read
1413
import recastapi.analysis.read
1514
import recastapi.response.write
1615

17-
recast = Blueprint('recast', __name__,
18-
template_folder='recast_interface_templates')
19-
16+
recast = Blueprint('recast', __name__, template_folder='recast_interface_templates')
2017

2118
@recast.route('/request/<int:reqid>')
2219
def recast_request_view(reqid):
@@ -26,26 +23,52 @@ def recast_request_view(reqid):
2623
analysis_info = recastapi.analysis.read.analysis(analysis_id)
2724

2825
parpoints = recastapi.request.read.point_request_of_scan(reqid)
26+
point_coordinates = {
27+
p['id']: {c['title']:c['value'] for c in p['point_coordinates']}
28+
for p in parpoints
29+
}
30+
2931
basic_req_data = {
30-
p['id']: recastapi.request.read.basic_request_of_point(p['id'])
32+
p['id']: p['requests']
3133
for p in parpoints
3234
}
3335

34-
wflow_config_labels = recastcatalogue().get(int(analysis_id), {}).keys()
36+
37+
print recastcatalogue()
38+
wflow_configs = recastcatalogue().get(int(analysis_id), {})
39+
40+
print wflow_configs,"HHUHUH"
3541
processing_info = {}
3642
for k, v in basic_req_data.iteritems():
3743
for basic_req in v:
38-
print 'basic_req', basic_req
39-
processing_info[basic_req['id']] = get_flattened_jobs(basic_req['id'], wflow_config_labels)
44+
processing_info[basic_req['id']] = get_flattened_jobs(basic_req['id'], wflow_configs.keys())
45+
46+
visdata = {
47+
'data': [
48+
{
49+
"values": [],
50+
"name": "pointrequests"
51+
}
52+
],
53+
'pars': point_coordinates.values()[0].keys()
54+
}
4055

56+
for i,p in enumerate(parpoints):
57+
pd = {}
58+
pd.update(global_pr_id = p['id'], scan_pr_id=i, **point_coordinates[p['id']])
59+
visdata['data'][0]['values'].append(pd)
60+
4161
log.info('proc info is %s', processing_info)
42-
43-
return render_template('recast_request.html', request_info=request_info,
44-
parpoints=enumerate(parpoints),
45-
basic_req_data=basic_req_data,
46-
analysis_info=analysis_info,
47-
wflow_configs=wflow_config_labels,
48-
processing_info=processing_info)
62+
return render_template('recast_request.html',
63+
request_info=request_info,
64+
visdata = visdata,
65+
point_coordinates = point_coordinates,
66+
parpoints=enumerate(parpoints),
67+
basic_req_data=basic_req_data,
68+
analysis_info=analysis_info,
69+
wflow_configs=wflow_configs,
70+
processing_info=processing_info
71+
)
4972

5073

5174
@recast.route('/wflowcatalgue')
@@ -56,7 +79,8 @@ def recast_workflow_catalogue_view():
5679
'implementations': v.keys()
5780
} for anaid,v in recastcatalogue().iteritems()
5881
]
59-
return render_template('recast_catalogue.html', catalogue_info = catalogue_info)
82+
return render_template('recast_catalogue.html',
83+
catalogue_info = catalogue_info)
6084

6185

6286
@recast.route('/requests')
@@ -66,19 +90,16 @@ def recast_requests_view():
6690
wflow_config_data = {}
6791

6892
full_configs = recastcatalogue()
69-
print full_configs
7093
for req in requests_info:
7194
identifier = req['analysis_id']
7295
labels = [] if identifier not in full_configs else full_configs[identifier].keys()
7396
wflow_config_data[req['id']] = labels
7497

75-
print wflow_config_data
7698
return render_template('recast_all_requests.html',
77-
requests_info=reversed(requests_info),
78-
wflow_config_data=wflow_config_data
99+
requests_info = reversed(requests_info),
100+
wflow_config_data = wflow_config_data
79101
)
80102

81-
82103
@recast.route('/processBasicRequest', methods=['GET'])
83104
def process_request_point():
84105
wflowconfig = request.args['wflowconfig']
@@ -90,14 +111,12 @@ def process_request_point():
90111
log.info('jobguid is: %s', jobguid)
91112
return jsonify(jobguid=jobguid)
92113

93-
94114
def zipdir(path, zipfile):
95115
for root, dirs, files in os.walk(path):
96116
for fl in files:
97117
zipfile.write(os.path.join(root, fl), os.path.join(
98118
root, fl).split('/', 2)[-1])
99119

100-
101120
def prepareupload(fullpath):
102121
stagingarea = '{}/stagingarea'.format(os.environ['RECAST_STORAGEPATH'])
103122
if not os.path.exists(stagingarea):
@@ -106,7 +125,6 @@ def prepareupload(fullpath):
106125
zipdir(fullpath, zipfile.ZipFile(zipfilename, 'w'))
107126
return zipfilename
108127

109-
110128
@recast.route('/uploadPointResponse')
111129
def uploadresults():
112130
if not 'user' in session:
@@ -122,5 +140,5 @@ def uploadresults():
122140
point_response = recastapi.response.write.point_response(
123141
scan_response['id'], request.args['pointreqid'], resultdata)
124142
recastapi.response.write.basic_response_with_archive(
125-
point_response['id'], request.args['basicreqid'], zipfilename, resultdata)
143+
point_response['id'], request.args['basicreqid'], resultdata, request.args['wflowconfig'], zipfilename)
126144
return jsonify(sucess='ok', resultdata=resultdata)

‎recastcontrolcenter/recast_interface_templates/recast_catalogue.html

+46-28
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,52 @@
1414

1515
{% block container%}
1616
<div class="page-header">
17-
<h1>Analysis Implementation Catalogue</h1>
18-
19-
<table id="analysisTable" class="table table-striped">
20-
<thead>
21-
<tr>
22-
<th>Inspire</th>
23-
<th>Title</th>
24-
<th>Implementations</th>
25-
</tr>
26-
</thead>
27-
<tbody>
28-
{% for row in catalogue_info %}
29-
<tr>
30-
{% set inspire_url = row['analysis_info']['inspire_URL'] %}
31-
32-
<td><a href="{{inspire_url}}">
33-
{{inspire_url.split('/')[-1] if inspire_url else 'N/A'}}
34-
</a></td>
35-
<td>{{row['analysis_info']['title']}}</td>
36-
<td style="width: 50%;">
37-
{% for impl in row['implementations'] %}
38-
<span class="label label-default"><span class="glyphicon glyphicon-tag" aria-hidden="true"></span> {{impl}}</span>
39-
{% endfor %}
40-
</td>
41-
</tr>
42-
{% endfor %}
43-
</tbody>
44-
</table>
17+
18+
<div class="row">
19+
<div class="col-md-8">
20+
<h1>Analysis Implementation Catalogue</h1>
21+
22+
<p>
23+
The listed analysis in the table below represent implementations of the analyses included to the public RECAST analysis catalogue. The list may not be exhaustive as some implementations (such as those from the Rivet and CheckMATE catalogues) are populated automatically. The implementations will
24+
show up as soon as the analyses are added to the public RECAST website.
25+
</p>
26+
</div>
27+
</div>
28+
<div class="row">
29+
<div class="col-md-12">
30+
31+
<table id="analysisTable" class="table table-striped">
32+
<thead>
33+
<tr>
34+
<th>Inspire</th>
35+
<th>ArXiv</th>
36+
<th>CDS</th>
37+
<th>Title</th>
38+
<th>Implementations</th>
39+
</tr>
40+
</thead>
41+
<tbody>
42+
{% for row in catalogue_info %}
43+
<tr>
44+
{% set arxiv_id = row['analysis_info']['arxiv_id'] %}
45+
{% set inspire_id = row['analysis_info']['inspire_id'] %}
46+
{% set cds_id = row['analysis_info']['cds_id'] %}
47+
48+
<td>{{inspire_id}}</td>
49+
<td>{{arxiv_id}}</td>
50+
<td>{{cds_id}}</td>
51+
<td>{{row['analysis_info']['title']}}</td>
52+
<td style="width: 50%;">
53+
{% for impl in row['implementations'] %}
54+
<span class="label label-default"><span class="glyphicon glyphicon-tag" aria-hidden="true"></span> {{impl}}</span>
55+
{% endfor %}
56+
</td>
57+
</tr>
58+
{% endfor %}
59+
</tbody>
60+
</table>
61+
</div>
62+
</div>
4563
</div>
4664

4765
{% endblock %}

0 commit comments

Comments
 (0)
Please sign in to comment.