The following is a simple example to give you an idea of how CloudSlang is structured and can be used to ensure your environment is set up properly.
This example uses the CloudSlang CLI to run a flow. See the CloudSlang CLI section for instructions on how to download and run the CLI.
Although CloudSlang files can be composed in any text editor, using a modern code editor with support for YAML syntax highlighting is recommended. See CloudSlang Editors for instructions on how to download, install and use the CloudSlang language package for Atom.
Download the code or
use the following instructions:
Create a folder examples and then another folder hello_world inside the examples folder. In the hello_world folder, create two new CloudSlang files, hello_world.sl and print.sl.
You should now have the following folder structure:
Copy the code below into the corresponding files.
namespace: examples.hello_world flow: name: hello_world workflow: - sayHi: do: print: - text: "'Hello, World'" navigate: - SUCCESS: SUCCESS results: - SUCCESS
namespace: examples.hello_world operation: name: print inputs: - text python_action: script: print text results: - SUCCESS
Start the CLI and enter the following command at the
run --f <path_to_files>/examples/hello_world/hello_world.sl --cp <path_to_files>/examples/hello_world
Use forward slashes in the file paths.
The output will look similar to this:
- sayHi Hello, World Flow : hello_world finished with result : SUCCESS Execution id: 101600001, duration: 0:00:00.790
The CLI runs the flow contained in the file passed to it using the
flag, namely hello_world.sl. The
--cp flag is used to specify the
classpath where the flow’s dependencies can be found. In our case, the flow refers
If you are using a CLI without the content folder, specifying the classpath in this instance is not necessary.
The flow named
hello_world begins its workflow. The
workflow has one step named
"Hello, World" to the
text input of the
SUCCESS. Since the flow does not
contain any more steps the flow finishes with a