Move to production with Anyscale Jobs and Services
This version of the Anyscale docs is deprecated. Go to the latest version for up to date information.
When it comes to moving applications to production, it's recommended to use Anyscale Jobs and Services. They are designed specifically for production-level reliability and management. Often, you would want to integrate code changes from Workspace back to your code repo, then use Anyscale SDK to trigger production Jobs and Services automatically. It's also easy to manually push the code from Workspace to run as a Job or Service.
Manually start Anyscale Jobs from Workspaces
You may want to manually start Anyscale Jobs from a Workspace in the following situations:
- You have finished your interactive development. Before checking in your code changes, you want to manually verify that the code runs properly as a Job.
- You want to run the code as a standalone job without going through CI/CD, whether a one-time job or a series of recurring jobs.
- You need to run a long-running experiment in a separate cluster decoupled from the Workspace itself.
Submit Anyscale jobs
You can submit Anyscale Jobs from your workspace using the Web Terminal, JupyterLab terminal or VS Code terminal. They will run in a separate cluster. Jobs submitted from Workspaces are shown on the Workspace UI and the Jobs UI.
Example usage
Create hello_world.yaml
:
name: "hello_world"
entrypoint: "python hello_world.py"
and hello_world.py
:
import ray
import anyscale
@ray.remote
def say_hi(message):
return f"Hello, {message}."
ray.init()
print(ray.get(say_hi.remote("World")))
Finally, run:
anyscale job submit hello_world.yaml --follow
Workspaces will automatically snapshot the working_dir
and the Job will inherit settings from the Workspace (Project, Cluster Environment, Compute Config) which can be overwritten in the YAML in the usual manner. This is to make sure your code runs in a consistent environment across development and production stages.
Move to production with Anyscale Services
If you have finished your interactive development of Ray Serve applications, it's recommended to move them into production with Anyscale Services for the benefits of High Availability and zero-downtime upgrade.
View the Develop and Deploy Anyscale Services tutorial for more info about how to move Serve Applications into production with Anyscale Services.