https://github.com/tilebox/tilebox-go
Tilebox Go SDK
https://github.com/tilebox/tilebox-go
data-science distributed-computing go satellite-data space space-data space-data-pipeline space-data-science tilebox
Last synced: 6 months ago
JSON representation
Tilebox Go SDK
- Host: GitHub
- URL: https://github.com/tilebox/tilebox-go
- Owner: tilebox
- License: mit
- Created: 2024-04-02T13:20:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-12T16:15:03.000Z (6 months ago)
- Last Synced: 2026-01-12T21:41:14.776Z (6 months ago)
- Topics: data-science, distributed-computing, go, satellite-data, space, space-data, space-data-pipeline, space-data-science, tilebox
- Language: Go
- Homepage: https://docs.tilebox.com
- Size: 1.38 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Documentation
|
Console
|
Example Gallery
# Tilebox Go
Go library for [Tilebox](https://tilebox.com), a lightweight space data management and orchestration software - on ground and in orbit.
## Installation
Run the following command to add the library to your project:
```bash
go get github.com/tilebox/tilebox-go
```
For Tilebox datasets type generation, you will need to install [tilebox-generate](https://github.com/tilebox/tilebox-generate) command-line tool.
## Examples
For examples on how to use the library, see the [examples](examples) directory.
## Usage
### Writing a Task
Here we define a simple task that prints "Hello World!" to the console:
```go
package helloworld
import (
"context"
"log/slog"
"github.com/tilebox/tilebox-go/workflows/v1"
)
type HelloTask struct {
Name string // You can add any fields you need to the task struct.
}
// The Execute method isn't needed to submit a task but is required to run a task.
func (t *HelloTask) Execute(context.Context) error {
slog.Info("Hello World!", "Name", t.Name)
return nil
}
// The Identifier method is optional and will be generated if not provided.
func (t *HelloTask) Identifier() workflows.TaskIdentifier {
return workflows.NewTaskIdentifier("hello-world", "v1.0")
}
```
### Submitting a Job
Here we create a Workflows client and submit a job with a single task:
```go
package main
import (
"context"
"log/slog"
"github.com/tilebox/tilebox-go/workflows/v1"
)
type HelloTask struct {
Name string
}
func main() {
ctx := context.Background()
client := workflows.NewClient()
job, err := client.Jobs.Submit(ctx, "hello-world",
[]workflows.Task{
&HelloTask{
Name: "Tilebox",
},
},
)
if err != nil {
slog.Error("Failed to submit job", slog.Any("error", err))
return
}
slog.Info("Job submitted", slog.String("job_id", job.ID.String()))
}
```
### Running a Worker
Here we create a TaskRunner and run a worker that is capable of executing `HelloTask` tasks:
```go
package main
import (
"context"
"log/slog"
"github.com/tilebox/tilebox-go/workflows/v1"
)
type HelloTask struct {
Name string
}
// The Execute method is required to run a task.
func (t *HelloTask) Execute(context.Context) error {
slog.Info("Hello World!", "Name", t.Name)
return nil
}
func main() {
ctx := context.Background()
client := workflows.NewClient()
runner, err := client.NewTaskRunner(ctx)
if err != nil {
slog.Error("failed to create task runner", slog.Any("error", err))
return
}
err = runner.RegisterTasks(&HelloTask{})
if err != nil {
slog.Error("failed to register tasks", slog.Any("error", err))
return
}
runner.RunForever(ctx)
}
```
## License
Distributed under the MIT License (`The MIT License`).