Workflow Files: A Comprehensive Guide for DeepSquare Applications

DeepSquare is a powerful platform that enables users to run applications and perform high-performance computing tasks. To leverage the full potential of the platform, it is crucial to understand workflow files. Workflow files serve as blueprints for running applications on DeepSquare, outlining resource allocation and the sequence of instructions for your application. This article provides a comprehensive guide on workflow files and offers insights into how to run them effectively on DeepSquare.

Understanding Workflow Files

Workflow files are used in software development and automation tools to define and manage workflows or processes. These files specify a series of steps, actions, or tasks that need to be executed in a specific order. Workflow files automate repetitive tasks, coordinate complex processes, and facilitate collaboration among team members.

In the context of DeepSquare, a workflow file defines the resources required by your application and the specific steps it should follow to execute its tasks. It serves as the backbone of any operation within the DeepSquare platform, providing a structured and systematic approach to running workloads.

Let’s examine an example of a workflow file:

The key components of a workflow file include:

1. Resources: This block defines the resource allocation for the entire job. It specifies the number of tasks, GPUs per task, CPUs per task, and memory per CPU required by your application.

2. EnableLogging: This field, when set to true, enables the DeepSquare logging system to receive application logs, allowing you to monitor task progress.

3. Steps: This block outlines the specific actions or instructions that your tasks will execute. Each step represents an individual operation within the workflow.

4. Command: Within each step, you define the command that should be executed. It could be a script, function call, or any other operation required by your application.

**Executing a Workflow**

To launch a workflow file on DeepSquare:

1. DeepSquare Dev App: You can access the DeepSquare Dev App, log in using your crypto wallet, and paste your workflow file (converted to JSON if necessary) to run it. The Dev App provides a user-friendly interface for managing workflows.

2. DeepSquare SDK: use the DeepSquare SDK, which offers a simple and abstracted interface from web3 to the DeepSquare Grid. The SDK provides programmatic control for submitting and managing jobs on DeepSquare.

Running a Simple HelloWorld

The HelloWorld workflow file is as follows:

“`json

{

  “resources”: {

    “tasks”: 1,

    “gpusPerTask”: 0,

    “cpusPerTask”: 1,

    “memPerCpu”: 1024

  },

  “enableLogging”: true,

  “steps”: [

    {

 “name”: “hello world”,

      “run”: {

        “command”: “echo \”Hello World\””

      }

    }

  ]

}

“`

The workflow file allocates resources for one task, with no GPU usage, one CPU, and 1024 MB of memory per CPU. It includes a single step named “hello world” that executes the command “echo \”Hello World\”” when run.

To execute this workflow:

1. Visit the DeepSquare Dev App and log in using your crypto wallet.

2. Ensure you have sufficient credits and SQUARE tokens to pay for transactions. You can always request additional credits using this form: app.deepsquare.run/credits

3. In the Workflow Editor, either write or paste the workflow JSON.

4. If the workflow is valid, click Submit to run the job.

Downloading Results and Reviewing Logs

After submitting the workflow, you can monitor the progress of your job through the Job Status page. Here, you can check the status of your job and review real-time logs by clicking on the Logs button.

Once the job completes, you can access the results, logs, and other output files in the designated output storage.

Running Workflows with DeepSquare SDK

For a programmatic approach, you can utilize the DeepSquare SDK to interact with the DeepSquare Grid. Here’s a brief overview:

1. Instantiating the client: To get an instance of the client, you need the private key of a web3 wallet that contains credits for paying job costs. You can also modify the contract and API the package interacts with, but using the default values ensures compatibility.

2. Sending a job: Before sending a job, you must permit DeepSquare to access your credits. Once permitted, you can request a job by providing the job definition and a unique job name.

3. Controlling the cost: You can control the allocated credits for a job by specifying an extra parameter when submitting the job. This allows you to adjust the allocated credits according to your requirements. It is important to note that DeepSquare is currently offering free compute.

4. Retrieving job information and logs: You can retrieve job information, such as status, cost, and timestamps, using the client’s `getJob` method. Logs can be fetched using the gRPC streaming service provided by the SDK.

5. Canceling a job: If needed, you can cancel a job using the `cancel` method provided by the SDK.

Conclusion

Workflow files play a crucial role in running applications on DeepSquare by providing a structured approach to resource allocation and task execution. By understanding workflow files and leveraging the DeepSquare Dev App or SDK, users can effectively utilize the platform’s capabilities. DeepSquare enables users to perform high-performance computing tasks efficiently and effectively, opening up new possibilities for application development and automation. Check our documentation and examples and try to run workflow files on DeepSquare

***

If you want to learn more about DeepSquare or connect with the team and the community, follow us on TwitterTelegramDiscord, LinkedIn and Instagram.

Sign up for our Newsletter

Your e-mail
Your data is safe!
Share
This website uses cookies to ensure you get the best experience on our website. Learn more