Commit Graph

50 Commits

Author SHA1 Message Date
Dan McGee
7b969772cc Add a mirror status JSON view
Requested in FS#21144. This should provide most if not all of the data that
was provided on the archlinux.de website, although there are some
differences in what is returned to the user. It is nearly the same data as
that provided in the HTML view, the difference being things are a bit more
machine-friendly and the list is not split into good and bad portions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 13:58:40 -06:00
Dan McGee
7a320edae1 Move database interaction out of the threaded section
We were seeing a lot of hangs and long-running never-ending processes. This
might be due to some multithreading issues within Django, so move the save()
calls to a loop after the join() on the threads doing the mirror polling.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 13:40:01 -06:00
Dan McGee
1553e2b5c9 Use check count for this URL, not max of all mirrors
Prevents a recently enabled mirror from getting unfairly represented as far
as completion percentage goes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 01:13:32 -06:00
Dan McGee
5db6522b35 Fix mirror check unicode function
Needed a few self. qualifiers in there.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-07 17:05:44 -06:00
Dan McGee
be3080f912 Don't require country on mirrorlist submission
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-07 11:55:08 -06:00
Dan McGee
3dea0da4a9 Ensure mirrorlist generator works if no status available
Saw this error come through on the live site today, as well as being
reproducible when no mirror check runs have happened in the last 24 hours on
a development machine. Let mirrors that have no available checks show up on
this page, but be sorted last and show a score of unknown.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-11-04 14:29:50 -05:00
Dan McGee
8973ee37c2 Show all mirrors if no IP version specified
I'm eating my words on this one- we don't want to filter to none() if we
don't have an IP version specified, because people hitting the URL without a
ip_version parameter would no longer get any mirrors back. Filter if they
are provided by using a Q() object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 19:15:50 -05:00
PyroPeter
952ca5f349 Allow filtering of mirrorlist by IP-version
Dan: Use a forms.MultipleChoiceField to match the protocol selection.

Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:57:38 -05:00
Dan McGee
fe5e460d06 Mirror check script cleanup
Don't import all the constants from logging, just use logging.* instead.
Also, fix some typos that somehow snuck into one of my commits.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:44:17 -05:00
PyroPeter
28cc96af28 Add mirrorresolv manage.py command
Dan:
* Fix up some style issues such as spacing between operators
* Ensure one failed lookup doesn't crash the whole script
* Be silent out of the box if there are no errors, just like mirrorcheck

Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:42:51 -05:00
PyroPeter
c057b079c7 Add has_ipv{4,6} to MirrorUrl
Dan: Add some more useful labels for use in the admin.

Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:25:54 -05:00
PyroPeter
670aefbb14 Add 'All' choice and make it the default
Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:14:10 -05:00
Dan McGee
e2612ab3f6 mirrorcheck: catch and handle another socket timeout case
We were seeing processes hang on the Arch server. It looks like there are
ways for socket.timeout to come out of the main check code, so add another
except block to catch this case. In addition, make sure we always call
task_done() even on failures so processes eventually die.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:49:04 -05:00
Dan McGee
82f3b02f60 Factor check completion pct into mirror score
Use it as the divisor in our slightly longer equation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 08:09:07 -05:00
Dan McGee
2e299273e2 mirrorcheck: record duration on file not found errors
On an HTTP 404, FTP 550, or inability to parse the lastsync file, record the
duration of the check even though we couldn't get a time from the mirror.
This allows for these checks to show up as completed but in error, which is
more what.

Previously, inability to parse the date was also recorded as a success, so
change that to be a failure and record an error message with it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 08:07:03 -05:00
Dan McGee
ed49122429 Fix an off by one error in math for check interval
Because we are averaging the interval and not the value, we need to subtract
one from the total we are dividing by. Whoops.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-01 18:08:54 -05:00
Dan McGee
ed6fbafb35 Update MirrorProtocol fixture data
Move it to the correct location and add the new field. Also tidy up some of
the instructions dealing with loading this data.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-30 14:36:38 -05:00
Dan McGee
bb84f9c96c Use new is_download field
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-30 14:32:54 -05:00
Dan McGee
3ebe31bdad Add is_download field to mirror protocols
This will replace all the usages of '!= rsync' and 'is ftp or http' we have
in the code with one check on a boolean flag.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-30 14:20:45 -05:00
Dan McGee
2c13364880 Mirror status improvements
* Fix sorting issues. '', 'unknown', and '∞' should now always sort after
  anything else in the list.
* Add a completion percentage column; this will tell you at a glance if a
  mirror is sometimes unresponsive. This should probably be incorporated
  into the mirror score.
* Make a few more things dynamic in the template, like the time back the
  page reflects.
* Add some additional template tags for formatting things.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-30 12:47:30 -05:00
Dan McGee
7def999b0a Fix migration dependencies exposed after moving models
When we moved some models from one app to another, we didn't do anything to
ensure the tables were created at all initially. Enforce this by adding the
minimal required dependencies- those migrations in the 'main' model that
last touched the involved models moving between apps.

Noticed-by: Angel Velasquez <angvp@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-29 15:16:39 -05:00
Dan McGee
bc5a5781bf Add a basic mirror details page
Still some work to do here, but this covers the basics of the public view we
can show for mirrors and their associated data. The upstream and downstream
links should be working OK to aid navigation, but right now we have some
potential dead links for non-authenticated users if they click a link to a
"private" mirror.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-24 19:39:37 -05:00
Dan McGee
1c6099f4b2 Make general mirror list view public
Hide some columns when not logged in because they aren't relevant for the
general public, but this will work nicely as a base page for all of our
known mirrors.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-24 19:39:37 -05:00
Dan McGee
10fca82816 Give more information about mirror check runs and frequency
Show how many times the check has ran in the last 24 hours, as well as the
average interval between checks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-24 19:39:36 -05:00
Dan McGee
e82e953aa2 Mirror status query refinements
Only show errors for active and public mirrors, and collapse two filter
calls into just one for our normal status query.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-24 13:26:08 -05:00
Dan McGee
0dba93a9fc Switch mirror status delay display to average delay
This takes a bit more work to compute, but since we cache all of this anyway
it isn't too big of deal. Using average delay instead of last delay will be
a bit more fair on mirrors that have odd syncing schedules, as well as
exposing those that only sync once a day. Also fix an issue that will arise
with cutoff_time being calculated once, and adjust mirror score to treat
hours delay as a float rather than an integer.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-22 13:28:12 -05:00
Dan McGee
550ef2eeeb Allow generated mirrorlist to take status info into account
By using the mirror score we calculate, we can sort the mirrors in the
generated mirrorlist for people.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 18:58:34 -05:00
Dan McGee
5b87b21ccd Allow caching of mirror status info
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 18:31:26 -05:00
Dan McGee
753329659e Prevent 500 if no mirror checks have ran
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 17:43:39 -05:00
Dan McGee
2a296af10d Add ordering, sorting, and a lot more info to mirror status page
This should get this to the point where it is releasable to the general
public for their use and pleasure. Still not sure on how often the check
should be run, and we probably want to incorporate this mined data into some
other things like the mirror list generator.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 17:30:14 -05:00
Dan McGee
b8a78408ff Small updates to mirrorcheck command
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 17:29:45 -05:00
Dan McGee
1f44788e1e Add debugger when having to parse lastsync file
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 09:10:33 -05:00
Dan McGee
40ac4818aa Add mirror status view
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 09:10:33 -05:00
Dan McGee
3d8bc07622 Add 'mirrorcheck' command
This does the actual work of going out and checking the mirror status. In
short, it polls every active mirror URL for the 'lastsync' file and then
records the appropriate details. These include the contents of that file,
how long the total time to retrieve took, and any errors encountered.

In order to finish up a bit faster, we spawn several threads to do the
actual work. This parallelization allows the whole check process to take
around 30 seconds rather than several minutes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 09:10:33 -05:00
Dan McGee
7c88e3e1a2 Rename generate mirrorlist view
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 09:10:33 -05:00
Dan McGee
0776b440b5 Add new MirrorLog model and associated migration
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 09:10:33 -05:00
Dan McGee
445bd7c80b Remove some leftover print statements
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-16 17:11:02 -05:00
Dan McGee
7dba848eaf Move mirror models out of main app
South actually makes this relatively painless if you get everything right,
so might as well start getting these out of the legacy main application to
eventually eliminate models being separate from their views.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-06 12:01:46 -05:00
Dan McGee
fae6667931 Put mirrors app under South control
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-06 11:44:22 -05:00
Dan McGee
872af225a9 Use direct_to_template in all remaining possible places
Rather than the need to include RequestContext() calls directly, we can
just use direct_to_template to do all the work for us.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-03 13:45:13 -05:00
Dan McGee
d57696c801 PyLint suggested cleanups
We had a bunch of extra imports, non-conventional variable names, spacing
issues, etc. that were relatively low-hanging fruit to clean up. Fix them
and make the code a bit cleaner in the process.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-28 11:41:19 -05:00
Dan McGee
70b03d3ef7 Default country selection to Any
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 20:11:48 -05:00
Dan McGee
2d407d9c1b mirrorlist: allow filtering by protocol
And add some more "static" URLs to access the non-country filtered lists.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 20:02:26 -05:00
Dan McGee
d29d23ecf3 Get mirrorlist view ready for general use
Make the page much more flexible- allow multiple countries to be selected
rather than just one in the form. Also add a lot more text to the page, and
move the 'all' option out into its own subheading rather than being in the
same form.

Both GET and POST requests are now allowed for ease of use from non-browser
scenarios or those that wish to update their mirrorlist automatically and
submit parameters to the URL.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 19:24:54 -05:00
Dan McGee
e5bd769432 Remove arch from mirrorlist generation
With pacman 3.4.0, we can now use the $arch variable so we don't need
architecture-specific mirrorlists.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 18:34:09 -05:00
Dan McGee
d709604102 Remove archweb prefix from all imports
Unnecessary, and lets us standardize on not using it everywhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-10 00:29:27 -06:00
Dan McGee
85ff158e2d Use select_related() for some mirror pages
We also traverse relationships here, so select the associated items.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-30 13:53:11 -06:00
Ismael Carnales
1c9d62d516 use RequestContext in mirrors.views.choose 2009-11-09 22:24:48 -02:00
Ismael Carnales
0b87e76891 fixed error in mirrors.views.choose 2009-11-09 22:24:47 -02:00
Ismael Carnales
6243f7ba66 added mirrors app from archweb_pub 2009-11-09 22:24:46 -02:00