Skip to content

Task Queue

The Task Queue shows tasks in execution, ready to be executed, and finished.

Task queue visualization

You can view the task queue in two ways:

  • In card format, where each card represents a single task:

Card task queue

  • In list format, where each line represents a single task:

List task line

You can identify the status of each task as follows:

Task line

It is also possible to use the filters State, Automation, Runner, Task ID, Start date and End date to view specific tasks.

Task Filters

Task information

You can follow the information of a task in two ways:

  1. Clicking directly on the task name within the task card.
  2. Clicking the icon with three points in the task card's upper corner and selecting the option Info.

info-card

And through the list of tasks, it is possible to access the detailed information by clicking on the task ID:

Lista Tarefa info

You will be redirected to a page with detailed task information using any of the above. Being able to view:

General execution information

Generals Infos

Where:

  • State: Carries the info on the state of the task.
  • Life Cycle: The lifetime of the task, from when it enters the queue until it completes.
  • Queue Time: The time that remained in the execution queue.
  • Execution: The task execution time, after leaving the execution queue.
  • Runner: The Runner responsible for executing the task.

Task finishing message

You can view the task-finishing message. If an error occurs during environment preparation or code execution, this information will be displayed in the finalization message.

You can also set a custom finish message. See more details about how to finish a task in Maestro in the following steps.

Message finish

Task parameters

You can also visualize the parameters used in the task.

Parameters

You will find the user-defined execution parameters when creating a new task.

Tip

The definition of the parameters set is done by developers when creating an automation process.

Learn more about how to create a task with or without parameters using:

General information from the task queue, task, and runtime

Task Queue Info

Where:

  • Queue control: It has task queue control information such as task priority, minimum execution date, and infos if the task has been interrupted or terminated by the Maestro UI.

  • Task summary: It has information from the task, such as ID, label, the user that started the task, and whether it is a test task.

  • Runtime: It has execution information, such as the Runner that performed the task and the date and time the task was created, started, and finished.

Task actions

On the task information screen, you will find the button Actions. This button allows:

  • Delete: Delete a task that is in the execution queue.
  • Interrupt: Request the interruption of the task. Learn more about this functionality here.
  • Terminate: Terminates the task forcing the execution to end.
  • Restart: Restart a task marked as the test.

Note

  • Tasks running only have actions Interrupt and Terminate.
  • Tasks in the queue only have actions Delete and Interrupt.
  • Only tasks defined as a test can reproduce the action Restart.
  • Finished tasks have no action available.

How to finish a task using the Maestro SDK

By default, when running a task for the first time without using any integration with Maestro, the task will finish with the status of Failed.

This happens because we must define the instructions to finish the task in the code and report the desired end status to Maestro.

Using the Maestro SDK in your automation code, you can easily finish tasks in Maestro.

Installation

If you don't have the dependency installed yet, just follow these instructions:

pip install botcity-maestro-sdk

Important

In addition to installing, remember to include the dependency in the bot's requirements.txt file.

<repositories>
    <repository>
        <id>nexus-botcity-public</id>
        <url>https://devtools.botcity.dev:8081/repository/botcity-public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <!-- Your other dependencies -->
    <dependency>
        <groupId>dev.botcity</groupId>
        <artifactId>maestro-sdk</artifactId>
        <version>2.0.3</version>
    </dependency>
</dependencies>
npm i @botcity/botcity-maestro-sdk
npm i @botcity/botcity-maestro-sdk

Importing the SDK

After installation, import the dependency and instantiate the Maestro SDK:

# Import for integration with BotCity Maestro SDK
from botcity.maestro import *

# Disable errors if we are not connected to Maestro
BotMaestroSDK.RAISE_NOT_CONNECTED = False

# Instantiating the Maestro SDK
maestro = BotMaestroSDK.from_sys_args()
# Fetching the details of the current task being executed
execution = maestro.get_execution()
// Import for integration with BotCity Maestro SDK
import dev.botcity.maestro_sdk.*;
...

public void action(BotExecution botExecution) {

    try {
        // Instantiating the Maestro SDK
        BotMaestroSDK maestro = new BotMaestroSDK();
        maestro.login(botExecution);
    ...
// Import for integration with BotCity Maestro SDK
const { BotMaestroSdk } = require('@botcity/botcity-maestro-sdk')

// Getting parameters passed by Runner
const args = process.argv.slice(2)
const [server, taskid, token] = args

// Login with information from the Dev. Environment page
const maestro = new BotMaestroSdk()
maestro.login("YOUR_SERVER_HERE", "YOUR_USER_HERE", "YOUR_KEY_HERE")

// Fetching the details of the current task being executed
const executionTask = await maestro.getTask(taskid)
// Import for integration with BotCity Maestro SDK
import { BotMaestroSdk } from '@botcity/botcity-maestro-sdk'

// Getting parameters passed by Runner
const args = process.argv.slice(2)
const [server, taskid, token] = args

// Login with information from the Dev. Environment page
const maestro: BotMaestroSdk = new BotMaestroSdk()
maestro.login("YOUR_SERVER_HERE", "YOUR_USER_HERE", "YOUR_KEY_HERE")

// Fetching the details of the current task being executed
const executionTask: Task = await maestro.getTask(taskid)

Finishing a task and reporting data

In addition to reporting the finish status of a task, we can also report additional data related to the items that were processed during execution.

maestro.finish_task(
    task_id=execution.task_id,
    status=AutomationTaskFinishStatus.SUCCESS,
    message="Task Finished with Success.",
    total_items=100, # Total number of items processed
    processed_items=90, # Number of items processed successfully
    failed_items=10 # Number of items processed with failure
)
maestro.finishTask(
    botExecution.getTaskId(),
    "Task Finished with Success.",
    FinishStatus.SUCCESS,
    100, // Total number of items processed
    90, // Number of items processed successfully
    10 // Number of items processed with failure
);
// Finishing the task successfully
await maestro.finishtTask(
    executionTask.id,
    "Task finished with Success.",
    "SUCCESS"
)
// Finishing the task successfully
await maestro.finishtTask(
    executionTask.id,
    "Task finished with Success.",
    "SUCCESS"
)

Info

The feature of reporting data is also part of the BotCity Insights, which is a module dedicated to reporting and displaying data related to your RPA initiative.

The step of reporting data in the automation code is essential for high-level information to be generated.

See more details about this module by accessing the BotCity Insights documentation.

Complete code

from botcity.core import DesktopBot
from botcity.maestro import *

# Disable errors if we are not connected to Maestro
BotMaestroSDK.RAISE_NOT_CONNECTED = False

def main():
    maestro = BotMaestroSDK.from_sys_args()
    execution = maestro.get_execution()

    bot = DesktopBot()
    # Implement here your logic...
    ...

    # Finishing the task successfully
    maestro.finish_task(
        task_id=execution.task_id,
        status=AutomationTaskFinishStatus.SUCCESS,
        message="Task Finished with Success.",
        total_items=100, # Total number of items processed
        processed_items=90, # Number of items processed successfully
        failed_items=10 # Number of items processed with failure
    )

def not_found(label):
    print(f"Element not found: {label}")

if __name__ == '__main__':
    main()
import dev.botcity.framework.bot.DesktopBot;
import dev.botcity.maestro_sdk.BotExecutor;
import dev.botcity.maestro_sdk.BotMaestroSDK;
import dev.botcity.maestro_sdk.model.AutomationTask.FinishStatus;
import dev.botcity.maestro_sdk.runner.BotExecution;
import dev.botcity.maestro_sdk.runner.RunnableAgent;

public class FirstBot extends DesktopBot implements RunnableAgent
{
    public FirstBot() {
        try {
            setResourceClassLoader(this.getClass().getClassLoader());
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void action(BotExecution botExecution) {

        try {
            BotMaestroSDK maestro = new BotMaestroSDK();
            maestro.login(botExecution);

            // Implement here your logic...

            // Finishing the task successfully
            maestro.finishTask(
                botExecution.getTaskId(),
                "Task Finished with Success.",
                FinishStatus.SUCCESS,
                100, // Total number of items processed
                90, // Number of items processed successfully
                10 // Number of items processed with failure
            );

        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    private void notFound(String label) {
        System.out.println("Element not found: "+label);
    }

    public static void main(String[] args) {
        BotExecutor.run(new FirstBot(), args);
    }
}
const main = async () => {
    const { BotMaestroSdk } = require('@botcity/botcity-maestro-sdk')

    const args = process.argv.slice(2)
    const [server, taskid, token] = args

    const maestro = new BotMaestroSdk()
    maestro.login("YOUR_SERVER_HERE", "YOUR_USER_HERE", "YOUR_KEY_HERE")

    const executionTask = await maestro.getTask(taskid)

    // Finishing the task successfully
    await maestro.finishtTask(
        executionTask.id,
        "Task finished with Success.",
        "SUCCESS"
    )
}

main()
const main = async () => {
    import { BotMaestroSdk } from '@botcity/botcity-maestro-sdk'

    const args = process.argv.slice(2)
    const [server, taskid, token] = args

    const maestro: BotMaestroSdk = new BotMaestroSdk()
    maestro.login("YOUR_SERVER_HERE", "YOUR_USER_HERE", "YOUR_KEY_HERE")

    const executionTask: Task = await maestro.getTask(taskid)

    // Finishing the task successfully
    await maestro.finishtTask(
        executionTask.id,
        "Task finished with Success.",
        "SUCCESS"
    )
}

main()

Tip

Look at the other operations we can do with tasks using the BotCity Maestro SDK and BotCity Maestro API.