Giter Club home page Giter Club logo

Comments (7)

michael-conway avatar michael-conway commented on August 20, 2024

see apps.routes.analysis.clj

(POST* "/" []
         :query   [params SecuredQueryParamsEmailRequired]
         :body    [body AnalysisSubmission]
         :return  AnalysisResponse
         :summary "Submit an Analysis"
         :description   "This service allows users to submit analyses for execution. The `config`
         element in the analysis submission is a map from parameter IDs as they appear in
         the response from the `/apps/:app-id` endpoint to the desired values for those
         parameters."
         (ok (coerce! AnalysisResponse
                  (apps/submit-job current-user body))))


from dfc-api-proto.

michael-conway avatar michael-conway commented on August 20, 2024

see /home/mconway/Documents/workspace-cyverse/DE/services/apps/src/apps/routes/domain/analysis.clj for a description of the post body for running an analysis

(defschema AnalysisSubmission
  {:app_id
   (describe String "The ID of the app used to perform the analysis.")

   (optional-key :job_id)
   (describe UUID "The UUID of the job being submitted.")

   (optional-key :callback)
   (describe String "The callback URL to use for job status updates.")

   :config
   (describe AnalysisSubmissionConfig "A map from (str step-id \"_\" param-id) to param-value.")

   (optional-key :create_output_subdir)
   (describe Bool (str "Indicates whether a subdirectory should be created beneath "
                       "the specified output directory."))

   :debug
   (describe Bool "A flag indicating whether or not job debugging should be enabled.")

   (optional-key :description)
   (describe String "An optional description of the analysis.")

   :name
   (describe String "The name assigned to the analysis by the user.")

   :notify
   (describe Bool (str "Indicates whether the user wants to receive job status update "
                       "notifications."))

   :output_dir
   (describe String "The path to the analysis output directory in the data store.")

   (optional-key :starting_step)
   (describe Long "The ordinal number of the step to start the job with.")

   (optional-key :uuid)
   (describe UUID (str "The UUID of the analysis. A random UUID will be assigned if one isn't "
                       "provided."))

   (optional-key :skip-parent-meta)
   (describe Bool "True if metadata should not associate metadata with the parent directory.")

   (optional-key :file-metadata)
   (describe [FileMetadata] "Custom file attributes to associate with result files.")

   (optional-key :archive_logs)
   (describe Bool "True if the job logs should be uploaded to the data store.")})

from dfc-api-proto.

michael-conway avatar michael-conway commented on August 20, 2024

Dennis had started to work on a job class here

https://github.com/DICE-UNC/publisher/blob/master/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/JobSubmission.java

from dfc-api-proto.

michael-conway avatar michael-conway commented on August 20, 2024

example post to analysis

Sep 23 09:16:50 dfc-de-svcs terrain[6955]: {"@timestamp":"2016-09-23T09:16:50.415-04:00","@Version":1,"message":"POST /analyses","loggerName":"AccessLogger","thread":"qtp833320357-15","level":"INFO","HOST
NAME":"1d73fc4c776c","request":"{"ssl-client-cert":null,"protocol":"HTTP/1.1","remote-addr":"172.25.8.217","params":{"ip-address":"192.168.1.5"},"jwt-claims":{"sub":"testde2","email
":"[email protected]","given_name":"testde2","family_name":"testde2","name":"testde2 testde2","org.iplantc.de:entitlement":["group3","group1"]},"route-params":{},"headers":{"x-de-
request-id":"UI-4c204a31-368a-4ca9-abc3-6df761099721","x-iplant-de-jwt":"eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ0ZXN0ZGUyIiwiZW1haWwiOiJ0ZXN0ZGUyQG1haWwub3JnIiwiZ2l2ZW5fbmFtZSI6InRlc3RkZTIiLCJmYW1pbHlfbmFt
ZSI6InRlc3RkZTIiLCJuYW1lIjoidGVzdGRlMiB0ZXN0ZGUyIiwib3JnLmlwbGFudGMuZGU6ZW50aXRsZW1lbnQiOlsiZ3JvdXAzIiwiZ3JvdXAxIl19.IoVqg42ZM0WLgve0GyDjNV5C_WSNY36_VcTm71AK8KeBDivhPQGb9y3hVD2FlpRM-WY_w1RGuNDujiM7gV1PrWT
pfsNbI3j3GNxy6q-B0Ivkaw9QETJtbm2mNsn6Jbl9I6XeVVv48QizKsEBmDz3_znv4skNK2rbPVNhqMyAA0FXuEhZPMyG_gENNp8XcO7R-1nnNA8swVuVuoMTutN8IcBdKZvdNBNA2mlPfA4BE2G2jwrPHQvghauixjQNxSnWcRiQFXPfm7SGk-stZaWhr5dcgjOlImUrp9k
juevRUF3jMHDgpd5_8_SyfL-Uq8OdxZp5xmwbURr-2OyFECQ6ig","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/52.0.2743.116 Chrome/52.0.2743.116 Safari/537.
36","connection":"keep-alive","host":"dfc-de-svcs.edc.renci.org:6000","accept-encoding":"gzip,deflate","content-length":"274","content-type":"application/json; charset=UTF-8"},"serve
r-port":6000,"content-length":274,"query-params":{"ip-address":"192.168.1.5"},"content-type":"application/json; charset=UTF-8","character-encoding":"UTF-8","uri":"/analyses","server-
name":"dfc-de-svcs.edc.renci.org","query-string":"ip-address=192.168.1.5","scheme":"http","request-method":"post"}","group-id":"org.iplantc","art-id":"terrain","service":"terrain","user-inf
o":"{"user":"testde2","email":"[email protected]","first-name":"testde2","last-name":"testde2"}","desc":"DE service for business logic","app-name":"terrain","service":"terrain"}
Sep 23 09:16:50 dfc-de-svcs apps[6955]: {"@timestamp":"2016-09-23T09:16:50.418-04:00","@Version":1,"message":"POST /analyses","loggerName":"AccessLogger","thread":"qtp204186372-19","level":"INFO","HOSTNAM
E":"7d2fdbf9aad3","request":"{"ssl-client-cert":null,"protocol":"HTTP/1.1","remote-addr":"192.168.1.1","params":{"email":"[email protected]","last-name":"testde2","config":{"089a61a0
-23d9-4021-9354-a8498ef3ff19_13914010-89cd-406d-99c3-9c4ff8b023c3":"/dfc1/home/testde2/boo/test.doc"},"name":"DE_Word_Count_analysis1","app_id":"67d15627-22c5-42bd-8daf-9af5deecceab","debug":
false,"first-name":"testde2","output_dir":"/dfc1/home/testde2/analyses","notify":true,"user":"testde2"},"body-params":{"notify":true,"debug":false,"app_id":"67d15627-22c5-42bd-8daf-
9af5deecceab","name":"DE_Word_Count_analysis1","output_dir":"/dfc1/home/testde2/analyses","config":{"089a61a0-23d9-4021-9354-a8498ef3ff19_13914010-89cd-406d-99c3-9c4ff8b023c3":"/dfc1/home/te
stde2/boo/test.doc"}},"headers":{"connection":"close","transfer-encoding":"chunked","user-agent":"Apache-HttpClient/4.5 (Java/1.8.0_74)","host":"dfc-de-svcs.edc.renci.org:5007","accept
-encoding":"gzip, deflate","content-type":"application/json"},"server-port":5007,"content-length":null,"form-params":{},"query-params":{"user":"testde2","email":"[email protected]",
"first-name":"testde2","last-name":"testde2"},"content-type":"application/json","character-encoding":"UTF-8","uri":"/analyses","server-name":"dfc-de-svcs.edc.renci.org","query-stri
ng":"user=testde2&email=testde2%40mail.org&first-name=testde2&last-name=testde2","scheme":"http","request-method":"post"}","group-id":"org.iplantc","art-id":"apps","service":"apps","user-info":
"{"user":"testde2"}","desc":"Framework for hosting DiscoveryEnvironment metadata services.","app-name":"apps","service":"apps"}
Sep 23 09:16:50 dfc-de-svcs apps[6955]: {"@timestamp":"2016-09-23T09:16:50.418-04:00","@Version":1,"message":"submission: {\n "config" : {\n "089a61a0-23d9-4021-9354-a8498ef3ff19_13914010-89cd-406d
-99c3-9c4ff8b023c3" : "/dfc1/home/testde2/boo/test.doc"\n },\n "name" : "DE_Word_Count_analysis1",\n "app_id" : "67d15627-22c5-42bd-8daf-9af5deecceab",\n "debug" : false,\n "output_dir
" : "/dfc1/home/testde2/analyses",\n "notify" : true\n}","loggerName":"apps.util.json","thread":"qtp204186372-19","level":"INFO","HOSTNAME":"7d2fdbf9aad3","group-id":"org.iplantc","art-id":"apps","se
rvice":"apps","user-info":"{"user":"testde2"}","desc":"Framework for hosting DiscoveryEnvironment metadata services.","app-name":"apps","service":"apps"}
Sep 23 09:16:50 dfc-de-svcs data-info[6955]: {"@timestamp":"2016-09-23T09:16:50.448-04:00","@Version":1,"message":"REQUEST: {:ssl-client-cert nil, :protocol HTTP/1.1, :remote-addr 192.168.1.1, :params {:u
ser testde2, :paths [/dfc1/home/testde2/boo/test.doc]}, :body-params {:paths [/dfc1/home/testde2/boo/test.doc]}, :headers {connection close, user-agent Apache-HttpClient/4.5 (Java/1.8.0_74), host dfc-de-s
vcs.edc.renci.org:5001, accept-encoding gzip, deflate, content-length 45, content-type application/json}, :server-port 5001, :content-length 45, :form-params {}, :query-params {user testde2}, :content-typ
e application/json, :character-encoding UTF-8, :uri /stat-gatherer, :server-name dfc-de-svcs.edc.renci.org, :query-string user=testde2, :scheme :http, :request-method :post}","loggerName":"data-info.util"
,"thread":"qtp397950078-15","level":"INFO","HOSTNAME":"8e23966f9738","group-id":"org.iplantc","art-id":"data-info","service":"data-info","desc":"DE service for data information logic and iRODS interaction
s.","app-name":"data-info","user-info":"{"user":"testde2"}","service":"data-info"}
Sep 23 09:16:50 dfc-de-svcs data-info[6955]: {"@timestamp":"2016-09-23T09:16:50.448-04:00","@Version":1,"message":"[call][do-stat] {:user testde2} {:paths [/dfc1/home/testde2/boo/test.doc]}","loggerName":
"trace.data-info.services.stat","thread":"qtp397950078-15","level":"TRACE","HOSTNAME":"8e23966f9738","group-id":"org.iplantc","art-id":"data-info","service":"data-info","desc":"DE service for data informa
tion logic and iRODS interactions.","app-name":"data-info","user-info":"{"user":"testde2"}","service":"data-info"}
Sep 23 09:16:50 dfc-de-svcs data-info[6955]: {"@timestamp":"2016-09-23T09:16:50.644-04:00","@Version":1,"message":"Retrieved types () from /dfc1/home/testde2/boo/test.doc for testde2.","loggerName":"data-
info.services.stat","thread":"qtp397950078-15","level":"INFO","HOSTNAME":"8e23966f9738","group-id":"org.iplantc","art-id":"data-info","service":"data-info","desc":"DE service for data information logic an
d iRODS interactions.","app-name":"data-info","user-info":"{"user":"testde2"}","service":"data-info"}
Sep 23 09:16:50 dfc-de-svcs data-info[6955]: {"@timestamp":"2016-09-23T09:16:50.656-04:00","@Version":1,"message":"[result][do-stat] [:paths {:/dfc1/home/testde2/boo/test.doc {:infoType , :path /dfc1/home
/testde2/boo/test.doc, :share-count 0, :date-created 1471982867000, :md5 sha2:y33VdpIJJ0fTop5k4E3lx7+Df/vtJF97aiJhdvSwAmE=, :permission :own, :date-modified 1471982867000, :type :file, :file-size 79360, :
label test.doc, :id 429dfb2e-696d-11e6-a8d2-005056a21427, :content-type application/msword}}] [:ids {}]","loggerName":"trace.data-info.services.stat","thread":"qtp397950078-15","level":"TRACE","HOSTNAME":
"8e23966f9738","group-id":"org.iplantc","art-id":"data-info","service":"data-info","desc":"DE service for data information logic and iRODS interactions.","app-name":"data-info","user-info":"{"user":"te
stde2"}","service":"data-info"}

from dfc-api-proto.

michael-conway avatar michael-conway commented on August 20, 2024

note that terrain uses ring filters to decorate requests to apps with necessary user and token info

see terrain/src/terrain/core.clj line 191

(def secured-routes-handler
  (-> (delayed-handler secured-routes)
      (wrap-routes authenticate-current-user)
      (wrap-routes wrap-user-info)
      (wrap-routes wrap-exceptions  cx/exception-handlers)
      (wrap-routes wrap-logging)))

refer to clojure docs at

https://github.com/ring-clojure/ring/wiki/Concepts

from dfc-api-proto.

michael-conway avatar michael-conway commented on August 20, 2024

jwt generation in terrain at terrain/src/terrain/util/jwt.clj line 51

(defn generate-jwt
  [user]
  ((jwt-generator) (jwt-user-from-terrain-user user)))


``

from dfc-api-proto.

michael-conway avatar michael-conway commented on August 20, 2024

test app id

67d15627-22c5-42bd-8daf-9af5deecceab

from dfc-api-proto.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.