Browse Source

Proper template for integrating both measurement scripts

Baptiste Jonglez 10 years ago
parent
commit
d4aa2b4e26
3 changed files with 30 additions and 5 deletions
  1. 5 0
      peerfinder.py
  2. 9 1
      templates/participant.html
  3. 16 4
      templates/participate.html

+ 5 - 0
peerfinder.py

@@ -268,6 +268,11 @@ def get_script():
     r = render_template('run.sh', peerfinder=app.config["PEERFINDER_DN42"])
     r = render_template('run.sh', peerfinder=app.config["PEERFINDER_DN42"])
     return r, 200, {'Content-Type': 'text/x-shellscript'}
     return r, 200, {'Content-Type': 'text/x-shellscript'}
 
 
+@app.route('/cron.sh')
+def get_cron():
+    r = render_template('cron.sh', peerfinder=app.config["PEERFINDER_DN42"])
+    return r, 200, {'Content-Type': 'text/x-shellscript'}
+
 @app.route('/target/<uuid>/<family>')
 @app.route('/target/<uuid>/<family>')
 @app.route('/target/<uuid>')
 @app.route('/target/<uuid>')
 def get_next_target(uuid, family="any"):
 def get_next_target(uuid, family="any"):

+ 9 - 1
templates/participant.html

@@ -24,13 +24,21 @@ ping on IRC to make sure your access is validated.  You can already setup
 the measurement script, it will start working as soon as your access is
 the measurement script, it will start working as soon as your access is
 validated.</p>
 validated.</p>
 
 
-<p>Here is a script you can run to fetch measurements and report back the
+<p>Here are scripts you can run to fetch measurements and report back the
 latency, with your UUID already pre-configured:</p>
 latency, with your UUID already pre-configured:</p>
 
 
+<h4>Shell script implemented as a self-contained loop</h4>
 <p>
 <p>
 <pre>
 <pre>
 {% include "run.sh" %}
 {% include "run.sh" %}
 </pre>
 </pre>
 </p>
 </p>
 
 
+<h4>Shell script that you can run in cron</h4>
+<p>
+<pre>
+{% include "cron.sh" %}
+</pre>
+</p>
+
 {% endblock %}
 {% endblock %}

+ 16 - 4
templates/participate.html

@@ -33,9 +33,21 @@ to peer.</p>
   <input type="submit" value="Register" />
   <input type="submit" value="Register" />
 </form>
 </form>
 
 
-<h3>Measurement script</h3>
-
-<p>The measurement script can be accessed <a href="/script.sh">here</a>.
-You need to edit the UUID.</p>
+<h3>Measurement scripts</h3>
+
+<p>Currently, two measurement scripts are available, depending on your needs:
+  <ul>
+    <li><a href="/script.sh">shell script implemented as a self-contained loop</a></li>
+    <li><a href="/cron.sh">shell script that you can run in cron</a></li>
+  </ul>
+  For both scripts, you need to edit the UUID variable to put your own UUID.
+</p>
+
+<p>Of course, you can write your own measurement scripts, using the
+still-undocumented API.  Please make sure that your scripts are not too
+aggressive: you should not fetch jobs more often than 30 seconds, while 1
+minute is a good value.  Please include a fairly large amount of jitter (a
+random sleep of at most 30 seconds, for instance).  This avoids
+synchronisation between participants.</p>
 
 
 {% endblock %}
 {% endblock %}