Skip to content

Result Files

Result Files or Artifacts are files that can be created or consumed during the processing of a task.

In this section you will find how to manipulate these files via SDK.

BotCity Orchestrator

You can view the Result Files functionality directly on the BotCity Orchestrator platform.

See more at:

Send an artifact

When executing a task, files of any type can be produced as a result of the processing.

You can send files of any type to the BotCity Orchestrator using the SDK. You need the following information:

  • Task ID: Reference of the task that will receive the file.
  • Artifact Name: Give a name and extension to the file that will be available in the Orchestrator.
  • Path: Define the path in the execution environment where the file is located.

File Size

It is recommended that a file be smaller than 100MB for the transfer to occur without issues.

Example of sending a file:

maestro.post_artifact(
    task_id=<TASK_ID>,
    artifact_name="My artifact.txt",
    filepath="resources/artifact.txt"
)
File artifact = new File("artifact.txt");
maestro.postArtifact(<TASK_ID>, "My artifact", artifact);
const file_path = "artifact.txt"
const artifact = await maestro.createArtifact(<TASK_ID>, "My artifact", file_path)
const file_path: string = "artifact.txt"
const artifact: Artifact = await maestro.createArtifact(<TASK_ID>, "My artifact", file_path)
using Dev.BotCity.MaestroSdk.Model.Artifact;

await maestro.PostArtifactAsync(
    <TASK_ID>,
    "My artifact",
    "artifact.txt"
);

Listing all artifacts

You can list the result files available in the BotCity Orchestrator using the SDK. You need the following information:

  • Days: Filter by number of days from the current date.

Default parameter

When the number of days is not provided, files from the last 7 days are returned by default.

Example of how to list files:

artifact = maestro.list_artifacts()
List<ArtifactVO> artifacts = maestro.listArtifact();
const artifact = await maestro.getArtifacts("10", "5")
const artifact: Artifacts = await maestro.getArtifacts("10", "5")
List<Artifact> artifacts = await maestro.listArtifactAsync();
Return example

The artifact list is a list of Artifact objects.

[
    Artifact(
        id=<ARTIFACT_ID>,, 
        type='RESULT', 
        task_id=<TASK_ID>,, 
        task_name=None, 
        name=<FILE_NAME>, 
        filename=<FILE_NAME>, 
        storage_filename=<FILE_NAME>, 
        storage_filepath=<FILE_PATH>, 
        organization=None, 
        user=None, 
        date_creation=<DATE>
        ),
]

Download an artifact

You can download the result files available in the BotCity Orchestrator using the SDK. You need the following information:

  • Artifact ID: Identification number of the file to download it.

Return

The default return is the file name and a byte array with the binary content of the artifact that can be saved locally.

Example of how to download files:

# Define artifact ID
artifact_id = "<ARTIFACT_ID>"

# Get artifact name and content
name, content = maestro.get_artifact(artifact_id=artifact_id)

# Write to disk
with open(name, "wb") as file:
    file.write(content)
File artifact = new File("<path to file>/artifact.txt");

// Define artifact ID
String artifactId = "<ARTIFACT_ID>";

// Get artifact content
byte[] data = maestro.getArtifactFile(artifactId);

// Write to disk
FileUtils.writeByteArrayToFile(artifact, data);
// Define artifact ID
const artifactId = "<ARTIFACT_ID>"

const file_path = "artifact.txt"

const data = await maestro.downloadArtifact(artifactId, file_path)
// Define artifact ID
const artifactId: string = "<ARTIFACT_ID>"

const file_path: string = "artifact.txt"

const data: Buffer = await maestro.downloadArtifact(artifactId, file_path)
using System;
using System.IO;

// Define artifact ID
string artifactId = "<ARTIFACT_ID>";

// Get artifact content
var (fileName, fileContent) = await maestro.GetArtifactAsync(artifactId);

string filePath = Path.Combine(Environment.CurrentDirectory, fileName);

// Write to disk
await File.WriteAllBytesAsync(filePath, fileContent);