Skip to content

Commit c5c0e47

Browse files
committed
Add --anyauth to curl
1 parent c0b7e57 commit c5c0e47

File tree

2 files changed

+78
-1
lines changed

2 files changed

+78
-1
lines changed

mopro/installation/download.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
def download_and_unpack(url, path, auth=None, strip=0, timeout=300):
66
os.makedirs(path)
77

8-
call = ['curl', '--silent', '-L', '--show-error', '--fail']
8+
call = ['curl', '--silent', '-L', '--show-error', '--fail', '--anyauth']
99
if auth is not None:
1010
call.extend(['--user', auth])
1111
call.append(url)

mopro/webinterface/__init__.py

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
from flask import Flask, render_template, jsonify
2+
import yaml
3+
import os
4+
import peewee
5+
from collections import defaultdict
6+
7+
from ..config import config
8+
from ..database import (
9+
initialize_database,
10+
CorsikaRun,
11+
CeresRun,
12+
CeresSettings,
13+
CorsikaSettings,
14+
Status,
15+
database
16+
)
17+
18+
sortkey = defaultdict(
19+
int,
20+
walltime_exceeded=-1,
21+
failed=-2,
22+
created=0,
23+
queued=1,
24+
running=2,
25+
success=3,
26+
)
27+
28+
29+
app = Flask(__name__)
30+
web_config = config.web_app.secret_key
31+
app.secret_key = config['app'].pop('secret_key')
32+
app.config.update(config.web)
33+
34+
initialize_database()
35+
36+
37+
@app.before_request
38+
def _db_connect():
39+
database.connect()
40+
41+
42+
@app.teardown_request
43+
def _db_close(exc):
44+
if not database.is_closed():
45+
database.close()
46+
47+
48+
@app.route('/')
49+
def index():
50+
return render_template('index.html')
51+
52+
53+
@app.route('/states')
54+
def states():
55+
states = [p.description for p in ProcessingState.select()]
56+
states = sorted(states, key=lambda k: sortkey[k])
57+
return jsonify({'status': 'success', 'states': states})
58+
59+
60+
@app.route('/jobstats')
61+
def jobstats():
62+
jobstats = list(
63+
ProcessingState.select(
64+
ProcessingState.description,
65+
Jar.version,
66+
XML.name.alias('xml'),
67+
peewee.fn.COUNT(Job.id).alias('n_jobs')
68+
)
69+
.join(Job)
70+
.join(XML)
71+
.switch(Job)
72+
.join(Jar)
73+
.group_by(Jar.version, XML.name, ProcessingState.description)
74+
.dicts()
75+
)
76+
return jsonify({'status': 'success', 'jobstats': jobstats})
77+
<Paste>

0 commit comments

Comments
 (0)