diff --git a/project.clj b/project.clj index 4a43e9cf..bf8f1da8 100644 --- a/project.clj +++ b/project.clj @@ -30,7 +30,7 @@ [org.cyverse/metadata-client "3.1.2"] [org.cyverse/common-cli "2.8.2"] [org.cyverse/common-cfg "2.8.3"] - [org.cyverse/common-swagger-api "3.4.7"] + [org.cyverse/common-swagger-api "3.4.8"] [org.cyverse/cyverse-groups-client "0.1.9"] [org.cyverse/permissions-client "2.8.4"] [org.cyverse/service-logging "2.8.4"] diff --git a/src/apps/routes/callbacks.clj b/src/apps/routes/callbacks.clj index a119165b..8dc7f21a 100644 --- a/src/apps/routes/callbacks.clj +++ b/src/apps/routes/callbacks.clj @@ -2,7 +2,7 @@ (:use [apps.routes.schemas.callback] [common-swagger-api.schema] [common-swagger-api.schema.analyses :only [AnalysisIdPathParam]] - [common-swagger-api.schema.callbacks :only [AgaveJobStatusUpdateParams AgaveJobStatusUpdate]] + [common-swagger-api.schema.callbacks :only [TapisJobStatusUpdate]] [ring.util.http-response :only [ok]]) (:require [apps.service.callbacks :as callbacks])) @@ -13,10 +13,9 @@ :description "The jex-events service calls this endpoint when the status of a DE analysis changes" (ok (callbacks/update-de-job-status body))) - (POST "/agave-job/:job-id" [] + (POST "/tapis-job/:job-id" [] :path-params [job-id :- AnalysisIdPathParam] - :body [body (describe AgaveJobStatusUpdate "The updated job status information.")] - :query [params AgaveJobStatusUpdateParams] - :summary "Update the status of an Agave analysis." - :description "The DE registers this endpoint as a callback when it submts jobs to Agave." - (ok (callbacks/update-tapis-job-status job-id (:lastUpdated body) params)))) + :body [body (describe TapisJobStatusUpdate "The updated job status information.")] + :summary "Update the status of an Tapis analysis." + :description "The DE registers this endpoint as a callback when it submts jobs to Tapis." + (ok (callbacks/update-tapis-job-status job-id body)))) diff --git a/src/apps/service/apps/tapis/jobs.clj b/src/apps/service/apps/tapis/jobs.clj index 5c2999af..dd66ba12 100644 --- a/src/apps/service/apps/tapis/jobs.clj +++ b/src/apps/service/apps/tapis/jobs.clj @@ -16,8 +16,7 @@ (defn- build-callback-url [id] - (str (assoc (curl/url (config/tapis-callback-base) (str id)) - :query "status=${JOB_STATUS}&external-id=${JOB_ID}&end-time=${JOB_END_TIME}"))) + (str (curl/url (config/tapis-callback-base) (str id)))) (defn- format-submission [_ job-id result-folder-path {:keys [config] :as submission}] diff --git a/src/apps/service/callbacks.clj b/src/apps/service/callbacks.clj index a38c2948..9a8e06ca 100644 --- a/src/apps/service/callbacks.clj +++ b/src/apps/service/callbacks.clj @@ -12,9 +12,12 @@ (apps/update-job-status uuid)) (defn update-tapis-job-status - [job-id last-updated {:keys [status external-id end-time]}] + [job-id {{:keys [timestamp type data]} :event}] (service/assert-valid job-id "no job UUID provided") - (service/assert-valid status "no status provided") - (service/assert-valid external-id "no external job ID provided") - (log/info (str "received a status update for Tapis job " external-id ": status = " status)) - (apps/update-job-status job-id external-id status (first (remove string/blank? [end-time last-updated])))) + (service/assert-valid type "no status provided") + (let [{:keys [jobUuid]} (service/parse-json data) + ; The `event.type` will be a string like "jobs.JOB_NEW_STATUS.FINISHED" + status (string/replace type #".*\." "")] + (service/assert-valid jobUuid "no external job ID provided") + (log/info (str "received a status update for Tapis job " jobUuid ": type = " type ", status = " status)) + (apps/update-job-status job-id jobUuid status timestamp)))