Created
April 24, 2019 21:44
-
-
Save mmerce/0a7044f28c71febb95c9e3e91c5b7741 to your computer and use it in GitHub Desktop.
WhizzML executes WhizzML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Creating and executing dependent scripts in a pipeline | |
;; script2 uses the output of an execution of script1 directly as input | |
;; and multiplies it by another input. | |
;; As one script uses the execution of the previous script, they will be executed | |
;; in a sequence | |
;; creating a first script that adds two numbers | |
(define script1 (create-script {"source_code" "(define sum (+ a b))" | |
"name" "Sum script" | |
"inputs" [{"type" "number" "name" "a"} | |
{"type" "number" "name" "b"}] | |
"outputs" [{"type" "number" "name" "sum"}]})) | |
;; creating a second script that multiplies two numbers | |
(define script2 | |
(create-script | |
{"source_code" "(* sum c)" | |
"name" "Multiplication script" | |
"inputs" [{"type" "number" "name" "sum"} | |
{"type" "number" "name" "c"}]})) | |
;; executing a list of two scripts in a pipeline, so that the output of script1 becomes one of the | |
;; inputs for script2 | |
(define final-execution | |
(create-and-wait-execution {"scripts" [script1 script2] | |
"input_maps" {script1 [["a" 1] ["b" 2]] | |
script2 [["c" 3]]}})) | |
;; reading the result from the final execution | |
(define output ((fetch final-execution) ["execution" "result"])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment