Skip to content

Auto 1202 documentation 2b#78

Open
DavidatVast wants to merge 3 commits intomainfrom
AUTO-1202-documentation-2b
Open

Auto 1202 documentation 2b#78
DavidatVast wants to merge 3 commits intomainfrom
AUTO-1202-documentation-2b

Conversation

@DavidatVast
Copy link
Contributor

2 example docs

from vastai import Worker, WorkerConfig, HandlerConfig, LogActionConfig, BenchmarkConfig

worker_config = WorkerConfig(
model_server_url="http://127.0.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't even need to specify this, since we default to this value.

"""Transform the incoming client payload before it reaches the backend."""
# The client sends {"name": "World"}, but our backend ignores the body.
# We could validate, reshape, or enrich the payload here.
return payload
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe actually having some code here, just something simple, instead of saying its possible, would be better.

Comment on lines +260 to +267
```bash
#!/bin/bash
cd /workspace
git clone <YOUR_REPO_URL> app # e.g. https://github.com/youruser/serverless-hello-world.git
cd app
pip install -r requirements.txt
python model_backend.py &
python worker.py
Copy link
Contributor

@LucasArmandVast LucasArmandVast Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good. But we need to show them to pull in the start_server.sh script from the pyworker repo, which does a bunch of helpful stuff.

bootstrap_script=https://raw.githubusercontent.com/vast-ai/pyworker/refs/heads/main/start_server.sh;
curl -L "$bootstrap_script" | bash;

^ This instead of python worker.py. It ultimately runs python worker.py. But this script will automatically pull in the repo, which we already specified...

This is tricky because the correct way to do things is to have two repos, one for your model backend and one for your pyworker. You then pull in the pyworker repo with the script and specify it with PYWORKER_REPO flag. But, this approach of putting both the code and the pyworker together is much better. This is what we are going for with deployments. However, it's not currently supported.

I actually think the best thing to do is to update our flow to allow this, since it is much cleaner and we are moving into the "one repo" pattern anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants