Skip to content

Commit 6114f8a

Browse files
committed
rename module to rpaframework
1 parent 5e9f9cd commit 6114f8a

27 files changed

+857
-182
lines changed

.github/workflows/main.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
working-directory: ./external-worker/
2626
- run: python -m unittest discover
2727
working-directory: ./external-worker/
28-
test-robocorp-client:
28+
test-rpa-framework-client:
2929
runs-on: ubuntu-latest
3030
strategy:
3131
matrix:
@@ -46,7 +46,7 @@ jobs:
4646
- run: python setup.py install
4747
working-directory: ./external-worker/
4848
- run: pip install -e ".[testing]"
49-
working-directory: ./robocorp/
50-
- run: cp -a external-worker/flowable/external_worker_client robocorp/flowable/ # we need to copy this module over, since it's only searching locally for modules
49+
working-directory: ./rpaframework/
50+
- run: cp -a external-worker/flowable/external_worker_client rpaframework/flowable/ # we need to copy this module over, since it's only searching locally for modules
5151
- run: python -m unittest discover
52-
working-directory: ./robocorp/
52+
working-directory: ./rpaframework/

.github/workflows/release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
packages-dir: external-worker/dist/
3232
verbose: true
3333

34-
build-robocorp-client:
34+
build-rpa-framework-client:
3535
runs-on: ubuntu-latest
3636
environment: release
3737
permissions:
@@ -49,11 +49,11 @@ jobs:
4949
- run: source venv/bin/activate
5050
- run: pip install setuptools
5151
- run: python setup.py sdist
52-
working-directory: ./robocorp/
52+
working-directory: ./rpaframework/
5353
- run: pip wheel --no-deps . -w dist
54-
working-directory: ./robocorp/
54+
working-directory: ./rpaframework/
5555
- name: Publish package distributions to PyPI
5656
uses: pypa/gh-action-pypi-publish@release/v1
5757
with:
58-
packages-dir: robocorp/dist/
58+
packages-dir: rpaframework/dist/
5959
verbose: true

.github/workflows/test-release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
packages-dir: external-worker/dist/
3535
verbose: true
3636

37-
build-robocorp-client:
37+
build-rpa-framework-client:
3838
runs-on: ubuntu-latest
3939
environment: release
4040
permissions:
@@ -52,12 +52,12 @@ jobs:
5252
- run: source venv/bin/activate
5353
- run: pip install setuptools
5454
- run: python setup.py sdist
55-
working-directory: ./robocorp/
55+
working-directory: ./rpaframework/
5656
- run: pip wheel --no-deps . -w dist
57-
working-directory: ./robocorp/
57+
working-directory: ./rpaframework/
5858
- name: Publish package distributions to Test PyPI
5959
uses: pypa/gh-action-pypi-publish@release/v1
6060
with:
6161
repository-url: https://test.pypi.org/legacy/
62-
packages-dir: robocorp/dist/
62+
packages-dir: rpaframework/dist/
6363
verbose: true

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ This is a collection of multiple Flowable Python clients.
99
Currently, the project consists out of:
1010

1111
* [External Worker Client](./external-worker): A library to connect custom application code to Flowable with the external worker functionality
12-
* [Robocorp Client](./robocorp-client): A python module to execute Robocorp actions and tasks with the Flowable Robocorp task (based on the external worker).
12+
* [RPA Framework Client](./rpaframework): A python module to execute RPA Framework tasks with the Flowable RPA Framework task (based on the external worker).

robocorp/README.md

-74
This file was deleted.

rpaframework/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
output

rpaframework/README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Flowable RPA Framework Client
2+
3+
[License:
4+
![license](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/flowable/flowable-external-client-python/blob/main/LICENSE)
5+
6+
![Flowable Actions CI](https://github.com/flowable/flowable-external-client-python/actions/workflows/main.yml/badge.svg?branch=main)
7+
8+
This is a python module to connect a Flowable installation through an external worker with a RPA framework task.
9+
This allows to execute an RPA framework task from a business process with BPMN or a case diagram CMMN.
10+
The application is started with a task definition from RPA framework and connects to an external worker topic.
11+
When using the RPA framework task in Flowable, it is possible to specify a task name.
12+
In the task, the specific task specified will be executed and the result will be sent back to the process.
13+
It is required that the variables in the diagram match exactly the variables inside the RPA framework task.
14+
15+
## Installation
16+
17+
To install the Flowable RPA framework client, execute the following command:
18+
19+
```
20+
pip install flowable.rpaframework-client
21+
```
22+
23+
## Sample
24+
25+
The following [diagram BPMN](docs/rpaframeworkExample.bpmn) illustrates a basic usage of the RPA framework task:
26+
27+
![Simple BPMN diagram with a start event, a RPA Framework task and an end event](docs/rpaframeworkExample.png)
28+
29+
The following example `get-weather-forecast.py` can be used as an RPA framework task:
30+
```
31+
32+
```
33+
34+
The RPA Framework worker can be started with the following command:
35+
```sh
36+
python -m flowable.rpaframework_client --flowable-token <your-token> myTopic myTask.robot
37+
```
38+
39+
You can request `<your-token>` at the [Flowable Trial](https://trial.flowable.com/work/) by clicking at the bottom left on your user and go to Settings.
40+
Once in the settings, choose "Access Token" and press the button "New token".
41+
After providing name and the validity, the token is generated and can be set.
42+
43+
Once the module is started and a process instance is created, it will automatically execute the RPA framework action and returns the result to Flowable.
44+
The Python module will keep running until stopped to process potential additional jobs.
45+
46+
## Authentication
47+
48+
Next to the cloud authentication, it's possible to authenticate against other hosts.
49+
The hostname can be specified with `--flowable-host`.
50+
51+
For the authentication there are two possibilities:
52+
53+
1. Providing a bearer token with the `--flowable-token <token>` attribute.
54+
2. Providing basic authentication with `--flowable-username <username>` and `--flowable-password <password>`

robocorp/docs/robocorpExample.bpmn renamed to rpaframework/docs/robocorpExample.bpmn

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
<extensionElements>
1111
<flowable:externalWorkerInParameter source="city" target="city"></flowable:externalWorkerInParameter>
1212
<flowable:externalWorkerInParameter source="days" target="days"></flowable:externalWorkerInParameter>
13-
<flowable:externalWorkerInParameter sourceExpression="get_weather_forecast" target="__robocorpTaskName"></flowable:externalWorkerInParameter>
13+
<flowable:externalWorkerInParameter sourceExpression="get_weather_forecast" target="__rpaFrameworkTaskName"></flowable:externalWorkerInParameter>
1414
<flowable:externalWorkerOutParameter source="temperature" target="temperature"></flowable:externalWorkerOutParameter>
15-
<design:stencilid><![CDATA[RobocorpTask]]></design:stencilid>
15+
<design:stencilid><![CDATA[RpaFrameworkTask]]></design:stencilid>
1616
<design:stencilsuperid><![CDATA[ExternalWorkerTask]]></design:stencilsuperid>
1717
</extensionElements>
1818
</serviceTask>
File renamed without changes.
File renamed without changes.

robocorp/flowable/robocorp_client/API.py renamed to rpaframework/flowable/rpaframework_client/API.py

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def flw_input(self, name: str):
1919
def flw_output(self, name: str, value: any):
2020
output_file_name = os.environ.get("FLOWABLE_OUTPUT_FILE")
2121
self.result[name] = value
22-
print('assign ' + name + '=' + value)
2322
if output_file_name is not None:
2423
with open(output_file_name, "w") as f:
2524
f.write(json.dumps(self.result))

robocorp/flowable/robocorp_client/__main__.py renamed to rpaframework/flowable/rpaframework_client/__main__.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
from flowable.external_worker_client import ExternalWorkerClient
66
from flowable.external_worker_client.cloud_token import FlowableCloudToken
7-
from flowable.robocorp_client.robocorp_handler import RobocorpActionHandler, RobocorpTaskHandler, RobocorpRobotHandler
7+
from flowable.rpaframework_client.rpaframework_handler import RobocorpActionHandler, RobocorpTaskHandler, RpaframeworkRobotHandler
88

99
if __name__ == "__main__":
10-
parser = argparse.ArgumentParser(description="Flowable Robocorp Client")
10+
parser = argparse.ArgumentParser(description="Flowable RPA Framework Client")
1111

12-
parser.add_argument('topic', help='Topic of the Robocorp Action to listen to')
13-
parser.add_argument('mode', type=str, choices=['action', 'task', 'robot'], help='Type of robocorp action/task/robot')
14-
parser.add_argument('path', type=str, help='The directory or file with the actions/tasks to run.')
12+
parser.add_argument('topic', help='Topic of the client to listen to')
13+
parser.add_argument('path', type=str, help='The directory or file with the RPA framework task to run.')
14+
parser.add_argument('--mode', type=str, choices=['robot', 'action', 'task'], default='robot', help='Type of rpaframework robot or robocorp action or task')
1515
parser.add_argument('--flowable-host', type=str, default='https://trial.flowable.com', help='URL of Flowable Work')
1616
parser.add_argument('--flowable-token', type=str, help='Bearer Token, can be used for example with the Flowable Trial')
1717
parser.add_argument('--flowable-username', type=str, help='Username for Flowable Work when using Basic Authentication')
@@ -20,7 +20,6 @@
2020
args = parser.parse_args()
2121

2222
topic = args.topic
23-
robocorp_action_file = args.path
2423
auth = None
2524
if args.flowable_token:
2625
auth = FlowableCloudToken(args.flowable_token)
@@ -31,9 +30,9 @@
3130
client = ExternalWorkerClient(args.flowable_host, auth=auth)
3231

3332
if args.mode == 'action':
34-
robocorp_job_handler = RobocorpActionHandler(robocorp_action_file)
33+
job_handler = RobocorpActionHandler(args.path)
3534
elif args.mode == 'task':
36-
robocorp_job_handler = RobocorpTaskHandler(robocorp_action_file)
35+
job_handler = RobocorpTaskHandler(args.path)
3736
else:
38-
robocorp_job_handler = RobocorpRobotHandler(robocorp_action_file)
39-
subscription = client.subscribe(topic, robocorp_job_handler.handle_task)
37+
job_handler = RpaframeworkRobotHandler(args.path)
38+
subscription = client.subscribe(topic, job_handler.handle_task)

robocorp/flowable/robocorp_client/call_robocorp.py renamed to rpaframework/flowable/rpaframework_client/call_python_module.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import sys
44

55

6-
def call_robocorp(args, mod_name, env=None):
6+
def call_python_module(args, mod_name, env=None):
77
if env is None:
88
env = os.environ.copy()
99
call_args = [sys.executable, "-m", mod_name]
1010
call_args.extend(args)
1111
try:
1212
return subprocess.run(call_args, capture_output=True, text=True, env=env)
1313
except subprocess.CalledProcessError as exc:
14-
print("ERROR: failed to call robocorp", exc.returncode, exc.output)
14+
print("ERROR: failed to call rpa framework", exc.returncode, exc.output)
1515

robocorp/flowable/robocorp_client/robocorp_handler.py renamed to rpaframework/flowable/rpaframework_client/rpaframework_handler.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import tempfile
66

77
from flowable.external_worker_client import ExternalWorkerAcquireJobResponse, WorkerResultBuilder
8-
from flowable.robocorp_client.call_robocorp import call_robocorp
8+
from flowable.rpaframework_client.call_python_module import call_python_module
99

1010

1111
def extract_action_and_parameters(job):
1212
action = None
1313
params = []
1414
for variable in job.variables:
15-
if variable.name == '__robocorpTaskName':
15+
if variable.name == '__rpaFrameworkTaskName':
1616
action = variable.value
1717
else:
1818
if variable.value is not None:
@@ -24,7 +24,7 @@ def extract_action_and_parameters_map(job):
2424
action = None
2525
params = {}
2626
for variable in job.variables:
27-
if variable.name == '__robocorpTaskName':
27+
if variable.name == '__rpaFrameworkTaskName':
2828
action = variable.value
2929
else:
3030
if variable.value is not None:
@@ -84,7 +84,7 @@ def handle_task(self, job: ExternalWorkerAcquireJobResponse, worker_result_build
8484
robocorp_args = ['run', self.robocorp_action_file, '-a' + action.__str__(), '--log-output-to-stdout=json', '-o' + output_dir, '--']
8585
robocorp_args.extend(params)
8686
print('---> Execute job "' + job.id + '"', robocorp_args)
87-
results = call_robocorp(robocorp_args, mod_name='robocorp.actions')
87+
results = call_python_module(robocorp_args, mod_name='robocorp.actions')
8888
if results.returncode != 0:
8989
print('---> Job execution failed for "' + job.id + '". Output saved to ' + output_dir)
9090
return worker_result_builder.failure().error_message('failed with status code ' + str(results.returncode)).error_details(results.stderr + results.stdout)
@@ -108,38 +108,38 @@ def handle_task(self, job: ExternalWorkerAcquireJobResponse, worker_result_build
108108
robocorp_args = ['run', self.robocorp_action_file, '-t' + action.__str__(), '-o' + output_dir, '--']
109109
robocorp_args.extend(params)
110110
print('---> Execute job "' + job.id + '"', robocorp_args)
111-
results = call_robocorp(robocorp_args, mod_name='robocorp.tasks')
111+
results = call_python_module(robocorp_args, mod_name='robocorp.tasks')
112112
if results.returncode != 0:
113113
print('---> Job execution failed for "' + job.id + '". Output saved to ' + output_dir)
114114
return worker_result_builder.failure().error_message('failed with status code ' + str(results.returncode)).error_details(results.stderr + results.stdout)
115115
print('---> Job execution done for "' + job.id + '". Output saved to ' + output_dir, robocorp_args)
116116
return worker_result_builder.success()
117117

118118

119-
class RobocorpRobotHandler:
120-
def __init__(self, robocorp_action_file: str):
121-
self.robocorp_action_file = robocorp_action_file
119+
class RpaframeworkRobotHandler:
120+
def __init__(self, rpaframework_action_file: str):
121+
self.rpaframework_action_file = rpaframework_action_file
122122

123123
def handle_task(self, job: ExternalWorkerAcquireJobResponse, worker_result_builder: WorkerResultBuilder):
124124
action, params = extract_action_and_parameters_map(job)
125125
if action is None:
126-
return worker_result_builder.failure().error_message('failed to find robocorp action name')
126+
return worker_result_builder.failure().error_message('failed to find rpaframework action name')
127127

128128
output_dir = create_output_dir(job)
129-
robocorp_args = ['--rpa', '--name', action.__str__(), '--report', 'NONE', '--outputdir', output_dir, self.robocorp_action_file]
130-
print('---> Execute job "' + job.id + '"', robocorp_args)
129+
rpaframework_args = ['--rpa', '--name', action.__str__(), '--report', 'NONE', '--outputdir', output_dir, self.rpaframework_action_file]
130+
print('---> Execute job "' + job.id + '"', rpaframework_args)
131131
tmp = tempfile.NamedTemporaryFile(delete=False)
132132
tmp.close()
133133
new_env = os.environ.copy()
134134
new_env["FLOWABLE_INPUT_VARIABLES"] = json.dumps(params)
135135
new_env["FLOWABLE_OUTPUT_FILE"] = tmp.name
136-
results = call_robocorp(robocorp_args, mod_name='robot', env=new_env)
136+
results = call_python_module(rpaframework_args, mod_name='robot', env=new_env)
137137

138138
if results.returncode != 0:
139139
print('---> Job execution failed for "' + job.id + '". Output saved to ' + output_dir)
140140
os.unlink(tmp.name)
141141
return worker_result_builder.failure().error_message('failed with status code ' + str(results.returncode)).error_details(results.stderr + results.stdout)
142-
print('---> Job execution done for "' + job.id + '". Output saved to ' + output_dir, robocorp_args)
142+
print('---> Job execution done for "' + job.id + '". Output saved to ' + output_dir, rpaframework_args)
143143

144144
with open(tmp.name, 'r') as content_file:
145145
content = json.loads(content_file.read())

robocorp/setup.py renamed to rpaframework/setup.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
long_description = (this_directory / "README.md").read_text()
88

99
setup(
10-
name='flowable.robocorp-client',
11-
packages=['flowable', 'flowable.robocorp_client'],
10+
name='flowable.rpaframework-client',
11+
packages=['flowable', 'flowable.rpaframework_client'],
1212
version='1.0.1rc3',
13-
description='Flowable client to be used with Robocorp. This client connects to a Flowable instance via external worker and executes robocorp tasks or actions.',
13+
description='Flowable client to be used with rpaframework. This client connects to a Flowable instance via external worker and executes rpaframework robots or robocorp tasks or actions.',
1414
long_description=long_description,
1515
long_description_content_type='text/markdown',
1616
author='Flowable',
1717
license='Apache License, Version 2.0',
18-
install_requires=['flowable.external-worker-client>=1.0.1rc3', 'robocorp-actions>=0.2.1', 'robocorp-tasks>=3.1.1', 'robocorp-truststore>=0.9.1'],
18+
install_requires=['flowable.external-worker-client>=1.0.1rc3'],
1919
extras_require={
20-
'testing': ['pytest', 'vcrpy', 'flowable.external-worker-client>=1.0.1rc3']
20+
'testing': ['pytest', 'vcrpy', 'flowable.external-worker-client>=1.0.1rc3', 'robocorp-actions>=0.2.1', 'robocorp-tasks>=3.1.1', 'robocorp-truststore>=0.9.1', 'rpaframework']
2121
},
2222
)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)