Commit Graph

202 Commits

Author SHA1 Message Date
Christopher Baines 413ef9ea6e Prioritise processing the latest revisions for branches
Reserve some capacity to process revisions which are the tip of a branch. This
should reduce the time between new revisions appearing, and then being
processed.
2019-07-16 18:20:02 +01:00
Christopher Baines 6904547bf2 Record jobs as failed when they are killed
So that they aren't retried again and again.
2019-07-14 14:43:47 +01:00
Christopher Baines 83ef624b97 Switch to processing jobs in parallel
This should speed up processing new revisions, reduce latency between finding
out about new revisions and processing them, as well as help manage memory
usage, by processing each job in a process that then exits.
2019-07-12 23:00:44 +01:00
Christopher Baines a6bd46b829 Obtain a lock when inserting the data for a new revision
This is working towards running the jobs in parallel. Each job looks at the
records in the database, and adds missing ones. If other jobs, running in
different transactions insert the same missing records at the same time, this
could cause an error.

Therefore, to just avoid this problem, lock before inserting the data. This
will allow the jobs to be processed in parallel, and it shouldn't have too
much of an effect on performance, as the slow bit is outside of the
transaction.
2019-07-12 19:57:13 +01:00
Christopher Baines 05c8287965 Lock around the channel fetch when loading new revisions
This is in preparation for running jobs in parallel. The channels code in Guix
uses a cached copy of the Git repository. Multiple jobs can't concurrently
access this without causing issues, so use an advisory lock to ensure that
only one job is using the repository at a time.
2019-07-12 19:56:58 +01:00
Christopher Baines 743cec7cb6 Associate a name with database connections
This helps when working out which connection to the database is doing what.
2019-07-12 19:49:26 +01:00
Christopher Baines 1b5db7adac Fix using defined? to check for the open-inferior/container function
It doesn't work as intended unless the module is also specified, so do that.
2019-07-09 19:48:01 +01:00
Christopher Baines 502dc93618 Fix issue inserting the empty log row
If the job started, and then was restarted, the row will already exist. So
don't error on a conflict.
2019-07-09 18:43:21 +01:00
Christopher Baines f2d28b4def Move around some of the load new revision code
To better separate the code that needs to happen after a lock has been
acquired to allow concurrently loading revisions without concurrent insertion
issues.
2019-07-07 21:59:36 +01:00
Christopher Baines 2ea78cff47 Tweak how logs are stored
Previously, the query for the jobs page was really slow, as it checked the
load_new_guix_revision_job_log_parts table for each job, doing a sequential
scan through the potentially large table.

Adding an index didn't seem to help, as the query planner would belive the
query could return loads of rows, where actually, all that needed checking is
whether a single row existed with a given job_id.

To avoid adding the index to the load_new_guix_revision_job_log_parts table,
and fighting with the query planner, this commit changes the
load_new_guix_revision_job_logs table to include a blank entry for jobs which
are currently being processed. This is inserted at the start of the job, and
then updated at the end to combine and replace all the parts.

This all means that the jobs page should render quickly now.
2019-07-07 21:23:18 +01:00
Christopher Baines 54b9922466 Iterate the log viewing
Replace the Guile-side HTML escaping with a less complete, but hopefully
faster PostgreSQL side HTML escaping approach.

Also, allow reading part of the log, by default, the last 1,000,000
characters, as this should render quickly.
2019-06-24 20:30:47 +01:00
Christopher Baines f504eec519 Direct the build output to the logging-port
So that this is logged.
2019-06-22 15:53:44 +02:00
Christopher Baines 05165929a5 Stop closing the log-port port
This part of the soft-port seems to be called, but I don't know why, and
trying to close the output port causes issues.
2019-06-22 15:52:09 +02:00
Christopher Baines d96add30a0 Record the output from loading new revisions to the database
So that it can easily be shown through the web interface. There's two tables
being used. One which temporarily stores the output as it's output while the
job is running, and other which stores the whole log once the job has
finished.
2019-06-22 01:51:49 +02:00
Christopher Baines baf2b17bf8 Re-arrange some of the load new revision code
Try to isolate the code that inserts in to the database, so that the relevant
tables can be locked during this time.
2019-06-21 15:47:59 +02:00
Christopher Baines 766656086f Add a couple of functions around timing
That don't rely on timing a single function.
2019-06-21 15:47:53 +02:00
Christopher Baines 398b8aab05 Log the time loading new revisions takes 2019-06-21 15:46:53 +02:00
Christopher Baines 548e628398 Set #:fallback? to #t
If a substitute fails, just build it anyway.
2019-06-21 15:45:50 +02:00
Christopher Baines 66364207f4 Process jobs starting with the most recent
Conventionally, you'd process the oldest job in a queue, but at the moment, it
would be more useful to have recent information more promptly, and fill in the
historical gaps later. I'm not sure this'll always be the case, but for now,
flip the order in which jobs are processed.
2019-06-19 23:54:12 +01:00
Christopher Baines 3df0b43146 Use line buffering for the input and output ports
As these are used for logging, which is done on a line by line basis. Remove
the now redundant calls to (force-output).
2019-06-17 18:09:10 +01:00
Christopher Baines 7f0a0ed3b1 Time everywhere a derivation is built when loading a new revision
As this is useful information.
2019-06-17 16:28:11 +01:00
Christopher Baines ed0745096a Add a new page listing jobs 2019-06-17 11:21:58 +01:00
Christopher Baines 33956b394f Improve the error message when a load revision job fails
It's useful to know the commit.
2019-06-15 11:07:42 +01:00
Christopher Baines 0bd1fc7e87 Display a backtrace for errors in channel->derivation-file-name
To help with debugging.
2019-06-13 23:13:34 +01:00
Christopher Baines 11144a5fe9 Catch the guix available when built
And use it for the hosting the inferiors, rather than computing the guix
package at runtime. This simplifies the behaviour when the Guix Data Service
is deployed as a Guix package.
2019-06-13 23:11:35 +01:00
Christopher Baines 6f379c7937 Rework creating /etc when building the derivation for a revision
Within an inferior. Just use the presence of open-inferior/container directly,
as this is more explicit.
2019-06-13 22:58:15 +01:00
Christopher Baines 5d06a28577 Add more detailed new revision job handling
Create a new events table for the new guix revision jobs, and update this when
processing a job starts, as well as finished with success or failure.

Additionally, remove the dependnency on open-inferior/container, as this
functionality isn't merged in to Guix master yet.
2019-06-02 22:00:29 +01:00
Christopher Baines 4ccf3132b6 Record job success without deleting the job record
Previously, the records for jobs would be deleted. It's useful to know when
jobs were inserted in to the database, as well as when they succeeded (if they
have). This change also makes it possible to keep track of jobs that have
failed, as they won't be deleted.
2019-06-02 21:48:02 +01:00
Christopher Baines 16799a34a9 Store license information for packages
And display this on the package page.

This uses a couple of new tables, and an additional field in the
package_metadata table.

Currently, the order of the licenses in the package definition isn't stored,
as I'm not sure the order in the list is significant.
2019-05-15 08:05:14 +01:00
Christopher Baines ce4c3c6ed3 Switch to storing Git repositories in a table
Rather than just storing the URL in the guix_revisions and
load_new_guix_revision_jobs tables. This will help when storing more
information like tags and branches in the future.
2019-05-05 14:36:52 +01:00
Christopher Baines a171287f27 Try harder to handle errors when loading new revisions
If the repl enters a bad state, attempt to exit, and catch failures in the
parent process, and rollback the open transaction.
2019-05-01 09:26:03 +01:00
Christopher Baines dbec236928 Clear the packages derivation cache
As this should help prevent issues when the previously cached derivation is
removed from the store.
2019-04-10 20:20:42 +01:00
Christopher Baines d62ea8857d
Better handle failures when computing the transative supported inputs 2019-03-29 09:14:03 +00:00
Christopher Baines 944492bd79
Deduplicate inferior packages
As sometimes there can be duplicates, for example with deprecated packages.
2019-03-29 09:13:29 +00:00
Christopher Baines 76d6027b7c
Try to handle the guix store item being garbage collected 2019-03-28 20:41:05 +00:00
Christopher Baines 0c02de432c
Order the index page guix revision jobs 2019-03-19 21:18:17 +00:00
Christopher Baines bdfb654233
Add support for processing branch updated emails 2019-03-19 20:21:54 +00:00
Christopher Baines a092db5007
Further improve load-new-guix-revision-jobs
Split the derivations up in to some groups, and run
invalidate-derivation-caches! inbetween to try and reduce the memory
usage.

Also make a couple of other changes to reduce memory usage or protect
against errors.
2019-03-16 17:26:44 +00:00
Christopher Baines 9f162c3b2c
Time more steps in load-new-guix-revision
This is useful for debugging purposes.
2019-03-15 09:31:52 +00:00
Christopher Baines c4c1f15050
Better guard against errors in packages when loading revisions
In particular, things like undefined variables in the package
definition.
2019-03-15 09:31:08 +00:00
Christopher Baines d2697d8dd2
Avoid loading in all derivations
Just load in the ones that are not already in the database, as this
will hopefully be faster and require less memory.
2019-03-14 08:18:01 +00:00
Christopher Baines a0dd298239
Hopefully speed up the new guix revision processing
Compute all derivations at once in the inferior, avoiding round trips
to hopefully speed it up. Close the inferior earlier to free up
memory, and add more debugging output.
2019-03-13 09:24:47 +00:00
Christopher Baines e117bb1d87
Many changes
A large proportion of these changes relate to changing the way
packages relate to derivations. Previously, a package at a given
revision had a single derivation. This was OK, but didn't account for
multiple architectures.

Therefore, these changes mean that a package has multiple derivations,
depending on the system of the derivation, and the target system.

There are multiple changes, small and large to the web interface as
well. More pages link to each other, and the visual display has been
improved somewhat.
2019-03-11 22:11:14 +00:00
Christopher Baines 623347d835
Add a list of the queued revisions to the index page 2019-03-03 18:15:29 +00:00
Christopher Baines ffdd2416f4
Guard against errors getting derivations for packages 2019-03-03 17:06:11 +00:00
Christopher Baines 853a2e4125
Handle failures in load-new-guix-revision
Currently, I think the desired commit can be missing, if patches come
in gradually, and the series changes after the first laminar job has
been run. Therefore, try to ignore some errors and just delete the
job.
2019-03-01 07:29:49 +00:00
Christopher Baines 17e76b4ef1
Support a source for a job
To describe why this job was enqueued.
2019-02-28 18:47:28 +00:00
Christopher Baines b8543859c9
Show when revisions are missing, but queued for processing 2019-02-24 16:52:45 +00:00
Christopher Baines a5cc703e18
Load new Guix revisions within a container
Use some experimental functionality to run the inferior repl in a
container. This provides some isolation.
2019-02-24 15:37:08 +00:00
Christopher Baines 83832a7862
Build new Guix revisions within an inferior
Once inferiors can provide some isolation, this will make building
guix in this way safer.
2019-02-23 20:15:35 +00:00
Christopher Baines c88d8335ba
Improve the model for derivations
These changes mean that more information about derivations is
recorded. There are a number of corresponding changes in the database
schema that are not tracked in the repository unfortunately.
2019-02-10 09:42:22 +00:00
Christopher Baines 5a9262b38d
Initial commit
This is a service designed to provide information about Guix. At the
moment, this initial prototype gathers up information about packages,
the associated metadata and derivations.

The initial primary use case is to compare two different revisions of
Guix, detecting which packages are new, no longer present, updated or
otherwise different.

It's based on the Mumi project.

[1]: https://git.elephly.net/software/mumi.git
2019-02-07 22:26:57 +00:00