Quick Start
Welcome to Datallog! This guide will get you from zero to a running automation in just a few minutes. Datallog allows you to write simple Python functions, called tasks, and run them as a distributed automation in the cloud. It handles all the complex infrastructure, so you can focus on your code.
Prerequisites
TIP
Before installing, it's a good idea to update your system packages to ensure you have the latest security patches and dependencies.
Linux
You can update your system packages using the following commands based on your distribution:
Ubuntu/Debian
sudo apt-get update && sudo apt-get upgrade -yFedora/RHEL/CentOS
sudo dnf update -yArch Linux
sudo pacman -SyumacOS
on macOS you can update Homebrew and installed packages with:
brew update && brew upgradeWindows (via WSL)
Datallog runs in a Linux environment. On Windows, you can achieve this using the Windows Subsystem for Linux (WSL).
- Install WSL: Follow the official Microsoft guide to install WSL. We recommend installing the Ubuntu distribution.
Once WSL and Docker are set up, open your WSL terminal (e.g., Ubuntu) and follow the Linux installation instructions below.
macOS
Ensure you have the Homebrew package manager installed. The installer script will use it to manage dependencies.
Linux
Ensure you have either the curl or wget command available. You can install them using your system's package manager (e.g., sudo apt install curl wget).
Installation
Installing the Datallog SDK is a simple one-liner. The script will automatically install all necessary dependencies, including pyenv, Docker, and the Datallog CLI.
Open your terminal (or your WSL terminal on Windows) and run one of the following commands:
curl -SsLf https://mwm.datallog.com/install.sh | bashOr, if you prefer wget:
wget -qO- https://mwm.datallog.com/install.sh | bashAfter the installation is complete, restart your terminal for the PATH changes to take effect.
Verify the installation by checking the version:
datallog --versionCreating Your First Automation
Let's build a simple "Hello, World!" automation. 🚀
1. Initialize a Project
First, create a new directory for your project, navigate into it, and initialize a Datallog project.
datallog create-project my-first-datallog-project
cd my-first-datallog-projectThis command creates a project.ini file, which manages your project's configuration and automations.
2. Create an Automation
Now, let's create a new automation within the project. We'll call it hello-auto.
datallog create-automation hello-autoThis will create a new directory named hello-auto with a default Python file inside.
3. Write the Code
Open the automations/hello-auto/hello-auto.py file and replace its contents with the following code:
from datallog import core_task, task
# The first task in our automation.
# The `next_task` argument tells Datallog where to send the output.
@core_task(next_task="second_task")
def first_task(seed):
"""
This function is the entry point and returns a simple string.
The 'seed' argument is the initial data passed when the automation is run.
"""
return seed["message"] if seed else "Hello, World!"
# The second and final task.
@task()
def second_task(text_input):
"""
This function receives the output from 'first_task'
and returns an uppercase version of it.
"""
return text_input.upper()4. Run the Automation
TIP
You can provide initial seed data to your automation in two ways:
- Use
--seedfor small, direct JSON values from the command line (e.g.,datallog run hello-auto --seed '{"message": "Hello!"}'). - Use
--seed-filefor larger or more complex JSON data stored in a file (e.g.,datallog run hello-auto --seed-file seed.json).
If you don't specify either option but aseed.jsonfile exists in your automation's directory, it will be used automatically.
Note:--seedand--seed-filecannot be used together.
You can run your automation locally to test it. Use the run command followed by the automation name.
datallog run hello-autoYou should see output indicating the tasks are being executed, with the final result being printed to the console.