diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2016-03-15 12:14:09 +0000 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2016-03-15 12:14:09 +0000 |
commit | d50d489fef861562c89e50f9301f064404bf4c96 (patch) | |
tree | 4bbf4e8986d9e3e64790bf4a609dc6c60ee55bf3 | |
parent | 193a191c0d0e0f2ff501f5ea7a11441ea6638506 (diff) |
lava-jobs: hacky support for finding last submitted job
-rw-r--r-- | lava-jobs.el | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lava-jobs.el b/lava-jobs.el index e04f2fd..bc662ef 100644 --- a/lava-jobs.el +++ b/lava-jobs.el @@ -83,8 +83,11 @@ symbols.") "Return a given field or `NIL' for a given job-id" (let ((info-hash (lava-jobs-get-hash job-id))) (gethash key info-hash))) - -;; Some generic access functions + +;; Return all the lava-jobs +(defun lava-jobs-get-all-jobs () + "Return a list of all LAVA jobs in the system." + (-map 'car lava-job-info)) (defun lava-jobs-get-actual-device (job-id) "Return the actual device this job is running on, or nil" @@ -112,6 +115,17 @@ symbols.") "Return a list of jobs in a given state." (--filter (string-match-p state (lava-jobs-get-field it "job_status")) list-of-jobs)) + +(defun lava-jobs-find-latest (list-of-jobs) + "Return the latest of `LIST-OF-JOBS' by update time." + (--max-by (let ((it-time (lava-jobs-get-field it "updated")) + (other-time (lava-jobs-get-field it "updated"))) + (time-less-p other-time it-time)) + list-of-jobs)) + +;; (lava-jobs-find-latest (lava-jobs-get-all-jobs)) +;; (lava-jobs-find-latest (lava-jobs-find-running-job-by-name "mustang-hacking-session")) + (defun lava-jobs-find-latest-running (list-of-jobs) "Return the latest running job of from `LIST-OF-JOBS'." (let ((running-jobs (lava-jobs-filter-by-state "Running" |