+ (find-job-by-project project)
+ :key #'job-sha))))
+ (when (not job) (raise-candle-error :job-does-not-exist))
+ job))
+
+(defun get-job-log (project-name sha)
+ "GET-JOB-LOG PROJECT-NAME SHA => LOG
+
+ARGUMENTS AND VALUES:
+
+ PROJECT-NAME: a string, representing the name of the project
+ SHA: a string, the commit sha for the job
+ LOG: the log from the run process
+
+DESCRIPTION:
+
+ Returns the log for the job specified. When the job wasn't run
+ (for instance, if no candle file), just returns NIL. The SHA
+ can be truncated, and if there are collisions, one of them will be
+ returned."
+ (job-log (find-job-by-project-and-sha project-name sha)))
+
+(defun retry-job (project-name sha)
+ "RETRY-JOB PROJECT-NAME SHA => UNUSED
+
+ARGUMENTS AND VALUES:
+
+ PROJECT-NAME: a string, representing the name of the project
+ SHA: a string, the commit sha for the job
+ UNUSED: the result is unused
+
+DESCRIPTION:
+
+ Sets the job specified by PROJECT-NAME and SHA to :queued, which will
+ then be run. Also awakes the processor thread to process it immediately
+ if available."
+ (set-job-status (find-job-by-project-and-sha project-name sha) :queued)
+ (awaken-processor-thread))
+
+(defun list-projects ()
+ "LIST-PROJECTS => PROJECTS-INFORMATION
+
+ PROJECTS-INFORMATION: PROJECT-INFORMATION*
+ PROJECT-INFORMATION: (NAME SRC FAILURES)
+
+ARGUMENTS AND VALUES:
+
+ NAME: a string, representing the name of the project
+ SRC: the git origin remote location
+ FAILURES: the number of failing branches
+
+DESCRIPTION:
+
+ Returns the information for all the projects in the system, as
+ is needed by the cli. Returns it as a list of lists, as specified
+ above."
+ (mapcar
+ (lambda (project)
+ (list
+ (project-name project)
+ (project-src project)
+ (failures (project-name project))))
+ *all-project*))
+
+(defun failures (&optional project-name)
+ "FAILURES &optional NAME => NUM-FAILURES
+
+ARGUMENTS AND VALUES:
+
+ NAME: a string, representing the name of the project
+ NUM-FAILURES: the number of failures
+
+DESCRIPTION:
+
+ Returns the number of failing branches. When NAME is specified,
+ the branches are limited to the project it refers to."
+ (let
+ ((project (find-project-by-name-or-die project-name)))
+ (length
+ (remove-if-not
+ (lambda (branch) (and (branch-in-git branch) (eql :failed (job-status (branch-job branch)))))
+ (if project (find-branch-by-project project) *all-branch*)))))