Examples¶
This section provides practical examples demonstrating Groundhog's features and common usage patterns.
Getting Started Examples¶
These examples cover the basics of using Groundhog:
- Hello World - The simplest possible Groundhog script showing basic remote execution
- Dependencies - Adding and using external packages in your remote functions
- Running Locally - Using
.local()to run functions in isolated local environments (without Globus Compute) - Organizing with Classes - Using
@hog.method()to group related functions into classes
Common Patterns¶
Examples showing how to handle typical workflows:
- Parallel Execution - Using
.batch_submit()or.batch_local()for concurrent execution - Parameterized Harnesses - Harnesses that accept CLI arguments for runtime configuration
- Endpoint Configuration - How the configuration system merges settings from multiple sources (PEP 723, decorators, call-time overrides)
- PyTorch from Custom Sources - Configuring uv to install packages from cluster-specific indexes, local paths, or internal mirrors
- Importing Groundhog Functions - Calling Groundhog functions from regular Python scripts, REPLs, and notebooks (includes import safety and
mark_import_safe())
Integration Examples¶
Examples showing how to use Groundhog with other frameworks:
- Academy Integration - Using Groundhog functions within Academy agents for isolated compute with dependency management
Running the Examples¶
All examples in this section are available in the examples directory of the Groundhog repository, and should be runnable with minimal modification (e.g. configuring your own endpoint/account etc)
To run an example:
-
Clone the repository:
-
Update the endpoint configuration in the example file to match your setup
-
Run with the
hogCLI: