Skip to content

Commit

Permalink
Merge branch 'master' into gav_dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMarkowitz committed Jun 6, 2016
2 parents 45dd673 + 26d4311 commit f2f8d72
Show file tree
Hide file tree
Showing 65 changed files with 686 additions and 438 deletions.
472 changes: 290 additions & 182 deletions cloudslang_dsl_reference.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cloudslang_editors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The following snippets are provided:
+-----------------------+-----------------------------------------------------+
| for | template for an iterative step |
+-----------------------+-----------------------------------------------------+
| async | template for an asynchronous step |
| parallel_loop | template for a parallel step |
+-----------------------+-----------------------------------------------------+
| property | template for a system property |
+-----------------------+-----------------------------------------------------+
Expand Down
27 changes: 12 additions & 15 deletions cloudslang_examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ concepts.
- `Example 2 - Default Navigation <#example-2-default-navigation>`__
- `Example 3 - Subflow <#example-3-subflow>`__
- `Example 4 - Loops <#example-4-loops>`__
- `Example 5 - Asynchronous Loop <#example-5-asynchronous-loop>`__
- `Example 5 - Parallel Loop <#example-5-parallel-loop>`__
- `Example 6 - Operation Paths <#example-6-operation-paths>`__

Each of the examples below can be run by doing the following:
Expand Down Expand Up @@ -384,39 +384,36 @@ looped on and various methods for handling loop breaks.
results:
- SUCCESS
.. _example_asynchronous_loop:
.. _example_parallel_loop:

Example 5 - Asynchronous Loop
=============================
Example 5 - Parallel Loop
=========================

This example demonstrates the usage of an asynchronous loop including
This example demonstrates the usage of a parallel loop including
aggregation.

:download:`Download code </code/examples_code/examples/async.zip>`
:download:`Download code </code/examples_code/examples/parallel.zip>`

**Flow - async_loop_aggregate.sl**
**Flow - parallel_loop_aggregate.sl**

.. code-block:: yaml
namespace: examples.async
namespace: examples.parallel
flow:
name: async_loop_aggregate
name: parallel_loop_aggregate
inputs:
- values: [1,2,3,4]
workflow:
- print_values:
async_loop:
parallel_loop:
for: value in values
do:
print_branch:
- ID: ${value}
publish:
- name
- num
aggregate:
publish:
- name_list: ${map(lambda x:str(x['name']), branches_context)}
- first_name: ${branches_context[0]['name']}
- last_name: ${branches_context[-1]['name']}
Expand All @@ -432,7 +429,7 @@ aggregation.

.. code-block:: yaml
namespace: examples.async
namespace: examples.parallel
operation:
name: print_branch
Expand Down
Binary file removed code/examples_code/examples/async.zip
Binary file not shown.
Binary file modified code/examples_code/examples/defaultnav.zip
Binary file not shown.
Binary file modified code/examples_code/examples/divide.zip
Binary file not shown.
Binary file modified code/examples_code/examples/hello_world.zip
Binary file not shown.
Binary file modified code/examples_code/examples/loops.zip
Binary file not shown.
Binary file added code/examples_code/examples/parallel.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
namespace: examples.async
namespace: examples.parallel

flow:
name: async_loop_aggregate
name: parallel_loop_aggregate

inputs:
- values: [1,2,3,4]

workflow:
- print_values:
async_loop:
parallel_loop:
for: value in values
do:
print_branch:
- ID: ${value}
publish:
- name
- num
aggregate:
publish:
- name_list: ${map(lambda x:str(x['name']), branches_context)}
- first_name: ${branches_context[0]['name']}
- last_name: ${branches_context[-1]['name']}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace: examples.async
namespace: examples.parallel

operation:
name: print_branch
Expand Down
Binary file modified code/examples_code/examples/paths.zip
Binary file not shown.
Binary file modified code/tutorial_code/tutorials_02.zip
Binary file not shown.
Binary file modified code/tutorial_code/tutorials_03.zip
Binary file not shown.
Binary file modified code/tutorial_code/tutorials_04.zip
Binary file not shown.
Binary file modified code/tutorial_code/tutorials_05.zip
Binary file not shown.
Binary file modified code/tutorial_code/tutorials_06.zip
Binary file not shown.
Binary file modified code/tutorial_code/tutorials_07.zip
Binary file not shown.
Binary file modified code/tutorial_code/tutorials_08.zip
Binary file not shown.
12 changes: 9 additions & 3 deletions code/tutorial_code/tutorials_08/hiring/check_availability.sl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ operation:
python_action:
script: |
import random
import string
rand = random.randint(0, 2)
vacant = rand != 0
#print vacant

# print vacant
if vacant == True:
password = ''.join(random.choice(string.letters) for _ in range(6))
else:
password = ''
outputs:
- available: ${vacant}

- password:
value: ${password}
sensitive: true
results:
- UNAVAILABLE: ${rand == 0}
- AVAILABLE
1 change: 1 addition & 0 deletions code/tutorial_code/tutorials_08/hiring/new_hire.sl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ flow:
- address
publish:
- availability: ${available}
- password
navigate:
- UNAVAILABLE: print_fail
- AVAILABLE: print_finish
Expand Down
Binary file modified code/tutorial_code/tutorials_09.zip
Binary file not shown.
12 changes: 9 additions & 3 deletions code/tutorial_code/tutorials_09/hiring/check_availability.sl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ operation:
python_action:
script: |
import random
import string
rand = random.randint(0, 2)
vacant = rand != 0
#print vacant

# print vacant
if vacant == True:
password = ''.join(random.choice(string.letters) for _ in range(6))
else:
password = ''
outputs:
- available: ${vacant}

- password:
value: ${password}
sensitive: true
results:
- UNAVAILABLE: ${rand == 0}
- AVAILABLE
2 changes: 2 additions & 0 deletions code/tutorial_code/tutorials_09/hiring/create_user_email.sl
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ flow:
- address
publish:
- availability: ${available}
- password
navigate:
- UNAVAILABLE: UNAVAILABLE
- AVAILABLE: CREATED

outputs:
- address
- password
- availability

results:
Expand Down
1 change: 1 addition & 0 deletions code/tutorial_code/tutorials_09/hiring/new_hire.sl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ flow:
- attempt
publish:
- address
- password
navigate:
- CREATED: print_finish
- UNAVAILABLE: print_fail
Expand Down
Binary file modified code/tutorial_code/tutorials_10.zip
Binary file not shown.
12 changes: 9 additions & 3 deletions code/tutorial_code/tutorials_10/hiring/check_availability.sl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ operation:
python_action:
script: |
import random
import string
rand = random.randint(0, 2)
vacant = rand != 0
#print vacant

# print vacant
if vacant == True:
password = ''.join(random.choice(string.letters) for _ in range(6))
else:
password = ''
outputs:
- available: ${vacant}

- password:
value: ${password}
sensitive: true
results:
- UNAVAILABLE: ${rand == 0}
- AVAILABLE
2 changes: 2 additions & 0 deletions code/tutorial_code/tutorials_10/hiring/create_user_email.sl
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ flow:
- address
publish:
- availability: ${available}
- password
navigate:
- UNAVAILABLE: UNAVAILABLE
- AVAILABLE: CREATED

outputs:
- address
- password
- availability

results:
Expand Down
1 change: 1 addition & 0 deletions code/tutorial_code/tutorials_10/hiring/new_hire.sl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ flow:
- attempt
publish:
- address
- password
break:
- CREATED
- FAILURE
Expand Down
Binary file modified code/tutorial_code/tutorials_11.zip
Binary file not shown.
12 changes: 9 additions & 3 deletions code/tutorial_code/tutorials_11/hiring/check_availability.sl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ operation:
python_action:
script: |
import random
import string
rand = random.randint(0, 2)
vacant = rand != 0
#print vacant

# print vacant
if vacant == True:
password = ''.join(random.choice(string.letters) for _ in range(6))
else:
password = ''
outputs:
- available: ${vacant}

- password:
value: ${password}
sensitive: true
results:
- UNAVAILABLE: ${rand == 0}
- AVAILABLE
2 changes: 2 additions & 0 deletions code/tutorial_code/tutorials_11/hiring/create_user_email.sl
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ flow:
- address
publish:
- availability: ${available}
- password
navigate:
- UNAVAILABLE: UNAVAILABLE
- AVAILABLE: CREATED

outputs:
- address
- password
- availability

results:
Expand Down
3 changes: 2 additions & 1 deletion code/tutorial_code/tutorials_11/hiring/new_hire.sl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ flow:
- attempt
publish:
- address
- password
break:
- CREATED
- FAILURE
Expand All @@ -56,7 +57,7 @@ flow:
- cost: ${total_cost}
publish:
- all_missing: ${missing + not_ordered}
- total_cost: ${cost + price}
- total_cost: ${cost + spent}
navigate:
- AVAILABLE: print_finish
- UNAVAILABLE: print_finish
Expand Down
4 changes: 2 additions & 2 deletions code/tutorial_code/tutorials_11/hiring/order.sl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ operation:
rand = random.randint(0, 2)
available = rand != 0
not_ordered = item + ';' if rand == 0 else ''
price = 0 if rand == 0 else price
spent = 0 if rand == 0 else price
if rand == 0: print 'Unavailable'

outputs:
- not_ordered
- price
- spent

results:
- UNAVAILABLE: ${rand == 0}
Expand Down
Binary file modified code/tutorial_code/tutorials_12.zip
Binary file not shown.
12 changes: 9 additions & 3 deletions code/tutorial_code/tutorials_12/hiring/check_availability.sl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ operation:
python_action:
script: |
import random
import string
rand = random.randint(0, 2)
vacant = rand != 0
#print vacant

# print vacant
if vacant == True:
password = ''.join(random.choice(string.letters) for _ in range(6))
else:
password = ''
outputs:
- available: ${vacant}

- password:
value: ${password}
sensitive: true
results:
- UNAVAILABLE: ${rand == 0}
- AVAILABLE
2 changes: 2 additions & 0 deletions code/tutorial_code/tutorials_12/hiring/create_user_email.sl
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ flow:
- address
publish:
- availability: ${available}
- password
navigate:
- UNAVAILABLE: UNAVAILABLE
- AVAILABLE: CREATED

outputs:
- address
- password
- availability

results:
Expand Down
6 changes: 4 additions & 2 deletions code/tutorial_code/tutorials_12/hiring/new_hire.sl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ flow:
- attempt
publish:
- address
- password
break:
- CREATED
- FAILURE
Expand All @@ -58,7 +59,7 @@ flow:
- cost: ${total_cost}
publish:
- all_missing: ${missing + not_ordered}
- total_cost: ${cost + price}
- total_cost: ${cost + spent}
navigate:
- AVAILABLE: print_finish
- UNAVAILABLE: print_finish
Expand All @@ -80,7 +81,8 @@ flow:
- subject: "${'New Hire: ' + first_name + ' ' + last_name}"
- body: >
${'Created address: ' + address + ' for: ' + first_name + ' ' + last_name + '<br>' +
'Missing items: ' + all_missing + ' Cost of ordered items: ' + str(total_cost)}
'Missing items: ' + all_missing + ' Cost of ordered items: ' + str(total_cost) + '<br>' +
'Temporary password: ' + password}
navigate:
- FAILURE: FAILURE
- SUCCESS: SUCCESS
Expand Down
4 changes: 2 additions & 2 deletions code/tutorial_code/tutorials_12/hiring/order.sl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ operation:
rand = random.randint(0, 2)
available = rand != 0
not_ordered = item + ';' if rand == 0 else ''
price = 0 if rand == 0 else price
spent = 0 if rand == 0 else price
if rand == 0: print 'Unavailable'

outputs:
- not_ordered
- price
- spent

results:
- UNAVAILABLE: ${rand == 0}
Expand Down
Binary file modified code/tutorial_code/tutorials_13.zip
Binary file not shown.
Loading

0 comments on commit f2f8d72

Please sign in to comment.