mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-04-20 15:55:49 -04:00
expose full rethinkdb entry as yaml on job page
This commit is contained in:
parent
510456eef2
commit
9b3f3809cc
2
setup.py
2
setup.py
@ -21,7 +21,7 @@ import glob
|
||||
|
||||
setuptools.setup(
|
||||
name='brozzler',
|
||||
version='1.1.dev18',
|
||||
version='1.1.dev19',
|
||||
description='Distributed web crawling with browsers',
|
||||
url='https://github.com/internetarchive/brozzler',
|
||||
author='Noah Levitt',
|
||||
|
@ -1,21 +1,21 @@
|
||||
#
|
||||
# brozzler-webconsole/__init__.py - flask app for brozzler web console, defines
|
||||
# api endspoints etc
|
||||
#
|
||||
# Copyright (C) 2014-2016 Internet Archive
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
'''
|
||||
brozzler-webconsole/__init__.py - flask app for brozzler web console, defines
|
||||
api endspoints etc
|
||||
|
||||
Copyright (C) 2014-2016 Internet Archive
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'''
|
||||
|
||||
import flask
|
||||
import rethinkstuff
|
||||
@ -25,6 +25,7 @@ import os
|
||||
import importlib
|
||||
import rethinkdb
|
||||
import logging
|
||||
import yaml
|
||||
|
||||
# flask does its own logging config
|
||||
# logging.basicConfig(
|
||||
@ -90,6 +91,7 @@ def pages(site_id):
|
||||
app.logger.info("flask.request.args=%s", flask.request.args)
|
||||
start = int(flask.request.args.get("start", 0))
|
||||
end = int(flask.request.args.get("end", start + 90))
|
||||
app.logger.info("yes new query")
|
||||
pages_ = r.table("pages").between(
|
||||
[site_id, 1, r.minval], [site_id, r.maxval, r.maxval],
|
||||
index="least_hops").order_by(index="least_hops")[start:end].run()
|
||||
@ -118,6 +120,14 @@ def job(job_id):
|
||||
job_ = r.table("jobs").get(job_id).run()
|
||||
return flask.jsonify(job_)
|
||||
|
||||
@app.route("/api/jobs/<int:job_id>/yaml")
|
||||
@app.route("/api/job/<int:job_id>/yaml")
|
||||
def job_yaml(job_id):
|
||||
job_ = r.table("jobs").get(job_id).run()
|
||||
return app.response_class(
|
||||
yaml.dump(job_, default_flow_style=False),
|
||||
mimetype='application/yaml')
|
||||
|
||||
@app.route("/api/workers")
|
||||
def workers():
|
||||
workers_ = service_registry.available_services("brozzler-worker")
|
||||
|
@ -137,6 +137,7 @@ function loadSiteStats($http, site, job) {
|
||||
|
||||
brozzlerControllers.controller("JobController", ["$scope", "$routeParams", "$http",
|
||||
function($scope, $routeParams, $http) {
|
||||
$scope.show_yaml = false;
|
||||
// console.log('JobController');
|
||||
$http.get("/api/config").success(function(data) {
|
||||
$scope.config = data.config;
|
||||
@ -158,6 +159,9 @@ brozzlerControllers.controller("JobController", ["$scope", "$routeParams", "$htt
|
||||
}
|
||||
});
|
||||
});
|
||||
$http.get("/api/jobs/" + $routeParams.id + "/yaml").success(function(data) {
|
||||
$scope.job_yaml = data;
|
||||
});
|
||||
}]);
|
||||
|
||||
brozzlerControllers.controller("SiteController", ["$scope", "$routeParams", "$http", "$window",
|
||||
|
@ -10,7 +10,12 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h2>Job {{job.id}} <small>{{job.started}}-{{job.finished}} {{job.status}}</small></h2>
|
||||
<h2 ng-click="show_yaml = !show_yaml">
|
||||
<span class="fa fa-caret-right"
|
||||
ng-class="{ 'fa-caret-right': !show_yaml, 'fa-caret-down': !!show_yaml }"></span>
|
||||
Job {{job.id}} <small>{{job.started}}-{{job.finished}}: {{job.status}}</small>
|
||||
</h2>
|
||||
<pre style="display:{{show_yaml?'block':'none'}}">{{job_yaml}}</pre>
|
||||
|
||||
<div class="row bigstats">
|
||||
<div class="col-sm-6 col-md-3">
|
||||
|
@ -1,3 +1,4 @@
|
||||
rethinkstuff>=0.1.5
|
||||
flask>=0.11
|
||||
gunicorn
|
||||
PyYAML
|
||||
|
Loading…
x
Reference in New Issue
Block a user