Skip to content

Commit

Permalink
Add --anyauth to curl
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Jan 8, 2020
1 parent c0b7e57 commit c5c0e47
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mopro/installation/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def download_and_unpack(url, path, auth=None, strip=0, timeout=300):
os.makedirs(path)

call = ['curl', '--silent', '-L', '--show-error', '--fail']
call = ['curl', '--silent', '-L', '--show-error', '--fail', '--anyauth']
if auth is not None:
call.extend(['--user', auth])
call.append(url)
Expand Down
77 changes: 77 additions & 0 deletions mopro/webinterface/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from flask import Flask, render_template, jsonify
import yaml
import os
import peewee
from collections import defaultdict

from ..config import config
from ..database import (
initialize_database,
CorsikaRun,
CeresRun,
CeresSettings,
CorsikaSettings,
Status,
database
)

sortkey = defaultdict(
int,
walltime_exceeded=-1,
failed=-2,
created=0,
queued=1,
running=2,
success=3,
)


app = Flask(__name__)
web_config = config.web_app.secret_key
app.secret_key = config['app'].pop('secret_key')
app.config.update(config.web)

initialize_database()


@app.before_request
def _db_connect():
database.connect()


@app.teardown_request
def _db_close(exc):
if not database.is_closed():
database.close()


@app.route('/')
def index():
return render_template('index.html')


@app.route('/states')
def states():
states = [p.description for p in ProcessingState.select()]
states = sorted(states, key=lambda k: sortkey[k])
return jsonify({'status': 'success', 'states': states})


@app.route('/jobstats')
def jobstats():
jobstats = list(
ProcessingState.select(
ProcessingState.description,
Jar.version,
XML.name.alias('xml'),
peewee.fn.COUNT(Job.id).alias('n_jobs')
)
.join(Job)
.join(XML)
.switch(Job)
.join(Jar)
.group_by(Jar.version, XML.name, ProcessingState.description)
.dicts()
)
return jsonify({'status': 'success', 'jobstats': jobstats})
<Paste>

0 comments on commit c5c0e47

Please sign in to comment.