Conversation
Co-authored-by: transientlunatic <4365778+transientlunatic@users.noreply.github.com>
Co-authored-by: transientlunatic <4365778+transientlunatic@users.noreply.github.com>
…ntation Co-authored-by: transientlunatic <4365778+transientlunatic@users.noreply.github.com>
Co-authored-by: transientlunatic <4365778+transientlunatic@users.noreply.github.com>
Co-authored-by: transientlunatic <4365778+transientlunatic@users.noreply.github.com>
|
@copilot This looks like a proming start! But some things are missing, like sphinx documentation (use the kentigern theme, and deploy automatically to github pages with github actions), and more importantly, the integration with asimov! You can see how other pages do that e.g. here: https://github.com/etive-io/asimov-cogwheel |
Co-authored-by: transientlunatic <4365778+transientlunatic@users.noreply.github.com>
Added all requested features in commit f419d1b:
The asimov integration follows the same pattern as asimov-cogwheel, with blueprint templates, HTCondor DAG support, and asset-based completion detection. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: transientlunatic <4365778+transientlunatic@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds a comprehensive blueprint-based pipeline construction utility to Gravitic, enabling users to define analysis pipelines using YAML files similar to GitHub Actions or GitLab CI workflows. The implementation includes core blueprint functionality, asimov integration for workflow automation, Sphinx documentation with automated GitHub Pages deployment, and a CLI interface for running pipelines.
Changes:
- Added blueprint-based pipeline system with YAML configuration support for defining sequential analysis steps with asset tracking
- Integrated with asimov workflow management via GraviticPipeline class implementing HTCondor DAG construction and job submission
- Comprehensive Sphinx documentation with automated GitHub Pages deployment, including quickstart, blueprint reference, asimov integration guide, and API documentation
Reviewed changes
Copilot reviewed 23 out of 25 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
gravitic/blueprint.py |
Core blueprint functionality including Blueprint, StepExecutor, and PipelineRunner classes for parsing, validating, and executing YAML-based pipelines |
gravitic/asimov.py |
Asimov integration providing GraviticPipeline class for HTCondor DAG construction, job submission, and completion detection |
gravitic/cli/__init__.py |
Added gravitic run command for executing blueprint files from the command line |
gravitic/__init__.py |
Module exports for blueprint functionality with graceful import handling for optional dependencies |
gravitic/data/__init__.py |
Made waveform import optional to improve compatibility |
gravitic/asimov_template.yaml |
Jinja2 template for rendering blueprint files with asimov production metadata |
setup.py |
Updated to use find_packages, include template as package data, and set zip_safe=False |
requirements.txt |
Added pyyaml dependency |
MANIFEST.in |
Package manifest for including template and documentation files |
.gitignore |
Added Python build artifacts and documentation build directories |
.github/workflows/build-docs.yaml |
GitHub Actions workflow for automated Sphinx documentation build and deployment to GitHub Pages |
docs/conf.py |
Enhanced Sphinx configuration with autodoc, viewcode, and intersphinx extensions |
docs/index.rst |
Updated main documentation page with project overview and navigation |
docs/quickstart.rst |
Getting started guide with installation and basic usage examples |
docs/blueprints.rst |
Comprehensive blueprint format reference with multiple examples |
docs/asimov.rst |
Asimov integration guide with configuration and usage examples |
docs/api.rst |
API reference documentation using autodoc |
README.rst |
Added blueprint pipeline documentation and security notes |
tests/test_blueprint.py |
Comprehensive test suite with 9 tests covering blueprint loading, validation, execution, and asset collection |
tests/__init__.py |
Test package initialization |
example_blueprint.yml |
Example bash-based pipeline |
example_python_blueprint.yml |
Example Python-based pipeline |
QUICK_REFERENCE.md |
Quick reference guide for blueprint format and usage |
IMPLEMENTATION_SUMMARY.md |
Detailed implementation summary document |
DOCUMENTATION_SUMMARY.md |
Documentation and asimov integration summary |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ] | ||
| }, | ||
| include_package_data=True, | ||
| # install_requires=requirements, |
There was a problem hiding this comment.
The install_requires parameter is commented out, which means the package dependencies (pyyaml, click) won't be automatically installed when users install gravitic. Uncomment this line to ensure dependencies are installed correctly. The requirements list is already being read from requirements.txt on line 9.
| # install_requires=requirements, | |
| install_requires=requirements, |
| with importlib.resources.path("gravitic", "asimov_template.yaml") as template_file: | ||
| config_template = template_file |
There was a problem hiding this comment.
The config_template is being set at class definition time using a context manager. However, this pattern may not work as expected because the context manager will exit immediately after the with block, potentially closing the resource. Consider using importlib.resources.files() (Python 3.9+) or read_text() to load the template content, or ensure the path object is properly handled outside the context manager.
| with importlib.resources.path("gravitic", "asimov_template.yaml") as template_file: | |
| config_template = template_file | |
| # Use importlib.resources.files() to obtain a stable reference to the | |
| # template resource without relying on a context manager whose scope | |
| # would end at class definition time. | |
| template_resource = importlib.resources.files("gravitic").joinpath("asimov_template.yaml") | |
| config_template = template_resource if template_resource.is_file() else None |
| request_cpus='1', | ||
| request_memory='2048MB', | ||
| request_disk='10GB', | ||
| getenv="True", |
There was a problem hiding this comment.
The getenv="True" setting in HTCondor submit description is deprecated in newer versions of HTCondor. Consider using getenv=True (boolean) instead of the string "True", or use the more modern approach with explicit environment variable passing via the environment parameter.
| getenv="True", | |
| getenv=True, |
| if not dryrun: | ||
| cluster_id = schedd.submit(dag_submit).cluster() | ||
| self.clusterid = cluster_id | ||
| return cluster_id |
There was a problem hiding this comment.
When dryrun is True, this method doesn't return a value, which is inconsistent with the non-dryrun case. Consider returning None explicitly when dryrun is True to make the behavior clear, or return a sentinel value to indicate a dry run was performed.
| return cluster_id | |
| return cluster_id | |
| return None |
| # Create the gravitic run command | ||
| run_command = f"run {blueprint}" |
There was a problem hiding this comment.
The blueprint variable is set to a path relative to cwd, but then passed to the gravitic run command without ensuring it will be accessible from the rundir. If the DAG runs from a different working directory than cwd, the blueprint file may not be found. Consider using an absolute path or copying the blueprint to the rundir.
| # Create the gravitic run command | |
| run_command = f"run {blueprint}" | |
| # Resolve blueprint to an absolute path to ensure it is accessible from the run directory | |
| blueprint_path = Path(blueprint).resolve() | |
| # Create the gravitic run command | |
| run_command = f"run {blueprint_path}" |
Gravitic lacked a pipeline construction utility for joining scripts into executable workflows. This adds YAML blueprint support similar to GitHub Actions/GitLab CI, enabling pipeline definition with sequential steps and asset tracking for integration with asimov workflows.
Implementation
Core module (
gravitic/blueprint.py):Blueprint- Parses and validates YAML pipeline definitionsStepExecutor- Executes scripts with configurable shells (bash, Python, etc.)PipelineRunner- Orchestrates sequential step execution in shared working directoryCLI enhancement:
gravitic run <blueprint.yml>command with progress reportingAsimov integration (
gravitic/asimov.py):GraviticPipeline- Implements asimov Pipeline interface for workflow automationDocumentation:
Dependencies:
pyyamlto requirementsBlueprint Format
Usage
Standalone
With Asimov
Documentation
Documentation is automatically built and deployed to GitHub Pages on push to master. Includes:
Security
Blueprints execute arbitrary shell commands by design (like GitHub Actions). Documentation includes warnings about trust models and recommendations for containerized execution (Docker/Podman/Apptainer) in production environments.
Testing
Added comprehensive test suite covering blueprint loading, validation, step execution, pipeline orchestration, and asset collection (9 tests, all passing).
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.