Skip to content

Commit 3458a40

Browse files
committed
Post-release fixes
1 parent 6d6d5e4 commit 3458a40

File tree

6 files changed

+30
-19
lines changed

6 files changed

+30
-19
lines changed

README.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
Robot Framework template implementing a Producer-Consumer model using custom libraries
44
and resources. This combines two already existing templates, such as the
5-
"Extended Robot Framework template" and "Producer-consumer model template", into one.
5+
**Extended Robot Framework template** and the **Producer-consumer model template**,
6+
into one.
67

78
It features the following:
89
- Producer-Consumer model: one task produces work and another consumes it.
@@ -12,8 +13,8 @@ It features the following:
1213
- Custom Python libraries placed in the [*libraries*](./libraries/) directory.
1314
- Custom reusable RF resources and variables file placed in
1415
[*resources*](./resources/).
15-
- Optional (setup) scripts to be ran before the robot starts in [*bin*](./bin/).
16-
(**rcc** only)
16+
- Optional (setup) scripts, to be ran before the robot starts, in [*bin*](./bin/).
17+
(**rcc** & Control Room only)
1718
- Locally mocked Work Items and environment variables JSON files, to customize the
1819
run and simulate the Control Room behavior, in [*devdata*](./devdata/).
1920

@@ -39,6 +40,10 @@ Every such task has its own `<Task Name> With Trace` flavor through which you ca
3940
enable a fine grained control over the robot run and enable error tracing as well with
4041
it. (debugging purposes)
4142

43+
> It is highly recommended to **rename and customize** all these tasks, including any
44+
> other file, resource or library, as the naming used here isn't suitable for
45+
> production. (it's just a template demo-ing the functionality)
46+
4247
### How to run
4348

4449
1. The first task runs with the only available initial input Work Item:
@@ -49,10 +54,10 @@ it. (debugging purposes)
4954

5055
Set `CREATE_REPORT` env var (in Control Room as well) if you decide to use the 3rd Step
5156
for reporting purposes. This is enabled by default locally in the
52-
[env.json](./devdata/env.json) file.
57+
[env.json](./devdata/env.json) file (and its other flavors when running with **rcc**).
5358

5459
Please go through the robot code and read the `[Documentation]` and comment sections
55-
for each of the tasks/keywords in order to understand the details.
60+
for each of the tasks/keywords in order to understand how the bot works in detail.
5661

5762
## Learn more
5863

@@ -67,5 +72,5 @@ for each of the tasks/keywords in order to understand the details.
6772
- [Extended Robot Framework Template](https://robocorp.com/portal/robot/robocorp/template-extended)
6873
- [Producer-Consumer Model Template](https://robocorp.com/portal/robot/robocorp/template-producer-consumer)
6974
- [Web Store Order Processor Using Work Items](https://robocorp.com/portal/robot/robocorp/example-web-store-work-items)
70-
- [Template for producer-consumer model robots using work items](https://robocorp.com/portal/robot/robocorp/example-producer-consumer-reporting)
75+
- [Reporting Producer-Consumer model with Excel and Browser](https://robocorp.com/portal/robot/robocorp/example-producer-consumer-reporting)
7176
- [Order in bulk the total number of requested robot parts](https://robocorp.com/portal/robot/robocorp/example-orders-distribution)

bin/generate-workitem-file.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pathlib import Path
1515

1616

17-
def main(argv, argc):
17+
def main(argc, argv):
1818
"""Main entry point of the script which gets executed before the bot starts."""
1919
# Use `argparse` for better support towards CLI argument parsing:
2020
# https://docs.python.org/3/library/argparse.html
@@ -34,5 +34,5 @@ def main(argv, argc):
3434
if __name__ == "__main__":
3535
# Call the main function with CLI arguments and exit with a return code. A non-zero
3636
# value will interrupt the bot execution.
37-
return_code = main(sys.argv, len(sys.argv))
38-
sys.exit(int(return_code or 0))
37+
return_code = main(len(sys.argv), sys.argv) # called with CLI arguments
38+
sys.exit(int(return_code or 0)) # exits with above return code

consumer.robot

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Documentation Robot Framework template implementing a Producer-Consumer model using
33
... custom libraries and resources. (Consumer robot which consumes input work)
44
5-
Library MyLibrary
5+
Library DummyLibrary
66
Library RPA.Robocorp.WorkItems
77

88
Resource keywords.robot
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
"""RF-importable library written in Python."""
1+
"""RF-importable library written in Python.
2+
3+
Attention! Please rename it and add your own useful keywords and documentation.
4+
"""
25

36
from robot.api import logger
47

58
# Variables can be accessed from the resources/variables.py Python module here as well.
69
from variables import TODAY
710

811

9-
class MyLibrary:
10-
"""Give this library a proper name and document it."""
12+
class DummyLibrary:
13+
"""Set a proper name, add useful methods and document it accordingly."""
1114

1215
def __init__(self):
13-
"""Add and document optional input data passed during the import."""
14-
# Additionally add a state available for the entire life of the library.
15-
self._context = object() # just an example (you can remove this)
16+
"""Add and document optional input data passed during the import. ([kw]args)"""
17+
# Additionally, add a state available for the entire life of the library.
18+
self._context = None # just a dummy example (used later on in the methods)
1619

1720
def log_today_in_python(self) -> None:
1821
"""Displays today's date in Python."""
1922
logger.info(f"Today is {TODAY}. (from Python)")
23+
self._context = "under logging keyword"
2024

2125
def my_library_keyword(self, var: str = "test") -> str:
2226
"""Describe what this RF exposed keyword does."""
2327
logger.info("Python code (as RF keyword) executed with value: %s", var)
28+
self._context = "under my keyword"
2429
return var

producer.robot

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Documentation Robot Framework template implementing a Producer-Consumer model using
33
... custom libraries and resources. (Producer robot which produces output work)
44
5-
Library MyLibrary
5+
Library DummyLibrary
66
Library RPA.FileSystem
77
Library RPA.Robocorp.WorkItems
88

resources/variables.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
from RPA.Robocorp.utils import get_output_dir
44

55

6-
# Various user-defined constants:
6+
# Current date formatted as a string in YYYY-MM-DD format.
77
TODAY = datetime.strftime(datetime.now(), "%Y-%m-%d")
8+
89
# File which gets attached in the output Work Items produced by the Producer. This file
9-
# is generated by a pre-run script configured in the robot.yaml.
10+
# is generated by a pre-run script configured in the robot.yaml during rcc/cloud runs.
1011
WORKITEM_FILE_PATH = str(get_output_dir() / "random-workitem-file.txt")

0 commit comments

Comments
 (0)