Orchestrating your automation¶
Prerequisites¶
- BotCity Account (Signup here)
- BotCity Studio SDK
- Python 3.7 or higher
- Java 11 or higher
Overview¶
Orchestration automation is possible to manage the execution of tasks in an automated way, being able to isolate tasks so that they can be executed sequentially.
BotCity Maestro is an automation platform used to support the development process of bots and other types of automation, deployment and orchestration of processes in runtime.
Life Cycle¶
The automation process contains a life cycle divided into a few steps:
- Process Preparation: the developer must know the processing flow.
- Creating the project: the developer creates the automation project, which can be in Python, Java, Javascript or Typescript.
- Developing Robot: the robot will be developed in this step.
- Deploy and Relase on Maestro: after the build is done the developer will send the robot to the platform and choose which version will be used in production.
- Creating runner: the developer will create the runner.
- Configuring BotRunner: the developer sets the
machineId
in the SDK configuration. - Creating automation: the developer will create the automation, selecting the
Runner
that was created and the robot that was deployed. - Starting the BotRunner: the developer will start the BotRunner from the terminal.
- Creating task: the developer or the user who will be responsible for running the robot will create a task for the BotRunner to execute.
- Task execution: the BotRunner will perform the task.
Creating a project¶
To build a bot we need to create a project in Java, Javascript or Python structure that will be used to develop the bot.
To create a project follow the tutorials below:
-
Python project
-
Java project
-
Javascript project
Important
In addition to template projects, you can also orchestrate your own custom projects.
See more details about orchestrate custom projects.
Info
For this tutorial we will be using a Python Web Bot project.
Building your project¶
To send the bot to Maestro you need to build the project. If you are in Windows run the build.bat
file in the root
directory of the project, otherwise run the build.sh
file under Linux or macOS.
.\build.bat
./build.sh
Tip
If you get a permission error, make sure that your build.sh
script has execution permission.
You can set the permission with the following command:
chmod +x build.sh
Java project
For Java projects, upload the generated .jar
file in the dist/
folder, if it generates two .jar
files upload the
file with jar-with-dependencies
in the filename.
Python project
For Python projects, upload the generated .zip
or .tar.gz
file in the dist/
folder.
Javascript project
For Javascript projects, upload a .zip
file containing the project files such as the bot.js
, resources
folder and package.json
.
Easy Deploy¶
After building the project, the next step is to deploy the automation to BotCity Maestro.
The easiest way to do your first deployment is through Maestro's Easy Deploy feature.
The Easy Deploy process is basically divided into three steps:
- Creating an automation
- Deploying a bot
- Choosing where to run
First Step - Creating an automation¶
The first step is to fill in the name of our automation process.
Info
See more details about Automations management in this section.
Second Step - Deploying a bot¶
The second step is to fill in the information regarding your bot.
You will upload the file referring to the bot, define which technology is being used and finally the name and version you want to use for the deployment.
Warning for legacy projects
For Python automations, if you are using a legacy project template, the bot identifier must match the id defined when creating the project.
If the auto-generated name is not the same as the ID of the created project, change it so that the identifiers match.
Basically, the bot identifier appears in the name of the generated .tar.gz
file being used.
Final Step - Choosing where to run¶
The third and final step is to define which Runner
will be associated with this automation.
You can select a Runner that you have previously created or enter an identifier to create a new one.
Important
In the conf.bcf
file from BotCity Studio SDK, enter the Runner id that will be used.
machineId=vm-01 # <- your runner id here
logScreen=true
logApplication=true
See more details about the BotCity Studio SDK configuration.
Info
See more details about Runners management in this section.
Success 🚀¶
Congratulations 🏆
In a few seconds, you managed to configure your automation process, associate it with your bot and define where it will be executed.
You now have the option to create a new task for this automation.
By doing so, a new task will be queued and as soon as the Runner
associated with the automation is active
the execution will start automatically.
Over the next sections, we will cover in more detail how to create and execute tasks.
Automation Management via BotCity Maestro¶
The Easy Deploy process is very useful for the first deployment of our automation.
However, at certain times we may need to deploy new versions or update existing versions of our bot associated with our automation.
BotCity Maestro offers several features to manage our automations.
From the My Bots menu you can:
- Deploy new bots and versions
- Set versions as the release (Production Version)
- Update the bot code
- Download the bot code for a given version
- Exclude a bot.
Updating your bot¶
You can update a bot by simply clicking on the pencil icon on the right side of the line associated with your desired bot version and selecting a new file to replace the current one.
Tip
The selected file will be an updated version of the file that is generated in the build
process.
To generate a new file, just repeat the build process after updating the bot code.
Deploying a new bot version¶
You can deploy a new bot or a new version of an existing bot by simply clicking on the Deploy button and filling the form with the Bot ID
, version
, file
and technology
used.
Defining a release version¶
You can define the released version by simply clicking on the ribbon icon (highlighted by the red arrow below). The version marked as "release" will be the version of the bot that will be used at the time of execution.
Info
See more details about Bots management in this section.
Managing tasks¶
Tasks are instances of an Automation that are created by the user via the Maestro User Interface, BotCity CLI, Maestro SDK or the Maestro API.
Task creation page¶
You can create a task via the task creation page in Maestro.
Just click on the New Task button referring to the automation process you want to execute.
Tip
The Automation created in the Easy Deploy process will be displayed on this page.
Info
See more details about the New Task page in this section.
Executing tasks¶
After creating a task, it will be sent to the queue and at that moment it will be ready to be executed.
The last necessary step is to activate Runner. Just run the BotRunner
or BotRunner-gui
script from the BotCity Studio SDK.
Finishing a task¶
Once tasks are created, they are queued on the BotMaestro and collected for execution by the BotRunner.
There are two ways to finish a task: via code (together with the bot code) or via CLI.
It is the bot developer responsibility to inform the BotMaestro via the SDK of the proper final status of a task.
Click here to learn how to finish a task using the Maestro SDK.
Info
Finish a task is just one of the possible integrations we can do with BotCity Maestro.
See more details about BotCity Maestro integrations in this section.
Tip
Most of the above functionalities can also be done through BotCity Command Line Interface.
See more details about the command lines that can be used.
Troubleshooting¶
Q: Runner does not run the robot
- Make sure you choose the runner correctly in the automation.
- Check if the SDK configuration is with the correct machineId.
- Make sure you start the runner.
- If you have the runner with GUI, click the "START" button to run the tasks in the queue.
- Open the
log.txt
file in the root directory of the SDK and check if there were any errors. - Make sure the runner is running in the terminal.
- Check that the runner has internet access.