QuickstartNew
Start a server, register a handler, create a job and watch it run, in about five minutes.
By the end of this page a job will have moved from queued to succeeded on your machine. You need the installed binary and a running server.
-
Describe a handler
A handler is a name Sextant can map to code. The simplest one is a shell command: Sextant sends the job payload on standard input and treats exit code
0as success.sextant.tomlTOML[server] listen = "127.0.0.1:7420" [store] driver = "sqlite" dsn = "file:sextant.db" [handlers.hello] exec = ["sh", "-c", "echo hello $(cat | jq -r .name)"] timeout = "30s" [queues.default] concurrency = 10 -
Start a worker
In a second terminal, with
SEXTANT_URLandSEXTANT_TOKENexported:Shellsextant worker --queues default -
Create a job
CLIShellsextant jobs create --queue default --handler hello --payload '{"name":"Ada"}'NodeTypeScriptimport { Sextant } from '@sextant/node'; const sextant = new Sextant({ token: process.env.SEXTANT_TOKEN }); const job = await sextant.jobs.create({ queue: 'default', handler: 'hello', payload: { name: 'Ada' }, }); console.log(job.id, job.state);PythonPythonimport os from sextant import Sextant client = Sextant(token=os.environ["SEXTANT_TOKEN"]) job = client.jobs.create(queue="default", handler="hello", payload={"name": "Ada"}) print(job.id, job.state)GoGoclient := sextant.NewClient(os.Getenv("SEXTANT_TOKEN")) job, err := client.Jobs.Create(ctx, &sextant.JobCreateParams{ Queue: "default", Handler: "hello", Payload: map[string]any{"name": "Ada"}, }) -
Watch it run
Shell$ sextant inspect job_8f3k2m9q job_8f3k2m9q hello default succeeded attempt 1 worker wrk_a91c7e 41 ms exit 0 output hello Ada
What just happened
- The server stored the job as
queued. - The worker leased it, ran
echo hello Adaand reported exit code0. - The server marked the job
succeededand kept the attempt record for seven days (seeretention).