Skip to content

Commit ffe5e7f

Browse files
authored
Merge pull request #9 from hdpriest-ui/add-ancillary-services
Add ancillary services
2 parents 2b9d668 + 84c3231 commit ffe5e7f

31 files changed

Lines changed: 30697 additions & 145 deletions

CHANGELOG.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ All notable changes to the ICRN Kernel Manager project will be documented in thi
55
## [Unreleased] - 2024-07-24
66

77
### Added
8-
- **Comprehensive Test Suite**: Added a complete test suite with 32 tests covering all major functionality
8+
- **Kernel Indexer**: New `kernel_indexer` script for indexing kernels and generating package manifests
9+
- Indexes R and Python kernels and extracts package information
10+
- Generates JSON manifest files for each kernel with package metadata
11+
- Collates manifests into kernel-centric and package-centric indexes
12+
- Supports filtering by language, kernel name, and version
13+
- Extracts packages from both conda and language-specific package managers
14+
- **Comprehensive Test Suite**: Added a complete test suite with 52+ tests covering all major functionality
15+
- `test_kernel_indexer.sh`: 20 tests covering kernel indexing and collation
916
- **Test Isolation**: Each test now runs in its own isolated environment to prevent interference
1017
- **Mock Data**: Tests use consistent mock kernel packages and catalogs for reliable testing
1118
- **Error Handling Tests**: Added tests for both success and failure scenarios
@@ -28,15 +35,18 @@ All notable changes to the ICRN Kernel Manager project will be documented in thi
2835
- `test_update_r_libs.sh`: 6 tests covering R library management
2936
- `test_config.sh`: 10 tests covering configuration validation
3037
- `test_help.sh`: 3 tests covering help and basic commands
38+
- `test_kernel_indexer.sh`: 20 tests covering kernel indexing and collation
3139
- **Test Environment**: Isolated environments created in `./tests/test_env/`
3240
- **Mock Data**: Sample R and Python kernels with proper catalog structure
41+
- **Mock Commands**: Tests include mock conda, Rscript, and python commands for isolated testing
3342
- **Error Messages**: Standardized error message format with "ERROR:" prefix
3443

3544
### Documentation
36-
- **Contributing Guide**: Added comprehensive testing section with examples
37-
- **Maintainer Guide**: Added testing recommendations for new kernels
45+
- **Contributing Guide**: Added comprehensive testing section with examples, including kernel_indexer test suite
46+
- **Maintainer Guide**: Added kernel indexing documentation for R and Python kernels
47+
- **Reference Documentation**: Added complete kernel_indexer command reference
3848
- **Troubleshooting**: Updated with improved error handling information
39-
- **README**: Added testing section with command examples
49+
- **README**: Added testing section with command examples, including kernel_indexer tests
4050

4151
## [Previous Releases]
4252

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ The project includes a comprehensive test suite to ensure reliability and code q
144144
./tests/run_tests.sh update_r_libs # R library management
145145
./tests/run_tests.sh config # Configuration validation
146146
./tests/run_tests.sh help # Help and basic commands
147+
./tests/run_tests.sh kernel_indexer # Kernel indexing and collation
147148
```
148149
149150
**Test Features:**

copy-data-to-container.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# Copy example data files to running Docker container
3+
# Run from root of git repository
4+
5+
# Find container
6+
CONTAINER_ID=$(docker ps -q --filter "ancestor=icrn-web" | head -1)
7+
8+
if [ -z "$CONTAINER_ID" ]; then
9+
echo "Error: No running container found. Is the container running?"
10+
exit 1
11+
fi
12+
13+
echo "Found container: $CONTAINER_ID"
14+
echo "Copying files..."
15+
16+
# Copy files
17+
docker cp web/examples/collated_manifests.json ${CONTAINER_ID}:/app/data/collated_manifests.json
18+
docker cp web/examples/package_index.json ${CONTAINER_ID}:/app/data/package_index.json
19+
20+
echo "Files copied successfully!"
21+
echo "Triggering reload..."
22+
curl -X POST http://localhost:8080/api/refresh
23+
24+
echo "Done! The website should now have data available."

documentation/source/contributing.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ The project includes a comprehensive test suite to ensure code quality and relia
3737
- `jq` - JSON processor for test data validation
3838
- `tar` - For testing kernel packaging functionality
3939
- `timeout` - For testing command timeouts (usually available on Linux systems)
40+
- `conda` - Required by `kernel_indexer` (mocked in tests)
4041

4142
**Running Tests:**
4243

@@ -50,6 +51,7 @@ The project includes a comprehensive test suite to ensure code quality and relia
5051
./tests/run_tests.sh update_r_libs # R library management
5152
./tests/run_tests.sh config # Configuration validation
5253
./tests/run_tests.sh help # Help and basic commands
54+
./tests/run_tests.sh kernel_indexer # Kernel indexing and collation
5355
5456
**Test Structure:**
5557
- **Test Isolation**: Each test runs in its own isolated environment to prevent interference
@@ -84,6 +86,15 @@ The project includes a comprehensive test suite to ensure code quality and relia
8486
- Invalid command handling
8587
- Usage information display
8688

89+
5. **Kernel Indexer** (`test_kernel_indexer.sh`)
90+
- Command validation and argument parsing
91+
- Kernel discovery and filtering
92+
- R and Python kernel indexing
93+
- Package extraction from conda and R
94+
- Manifest generation and validation
95+
- Kernel-centric and package-centric collation
96+
- Error handling and edge cases
97+
8798
**Test Environment:**
8899
- Tests create isolated environments in `./tests/test_env/`
89100
- Each test cleans up after itself

documentation/source/maintainer/python_kernels.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,39 @@ For detailed instructions on creating Python kernels, see the kernel creation do
2525

2626
jupyter_pieces
2727

28+
Indexing Kernels
29+
----------------
30+
31+
The ``kernel_indexer`` script can be used to create package manifests and inventory all kernels in a repository. This is useful for:
32+
33+
- Tracking which packages are included in each kernel
34+
- Generating package inventories for documentation
35+
- Creating indexes for package discovery
36+
37+
To index all Python kernels in a repository:
38+
39+
.. code-block:: bash
40+
41+
./kernel_indexer index --kernel-root /path/to/repository --language Python
42+
43+
This creates a ``package_manifest.json`` file in each kernel directory containing:
44+
- Kernel name and version
45+
- Language and language version
46+
- Complete list of packages with versions and sources
47+
- Indexing timestamp
48+
49+
To create collated indexes for all kernels:
50+
51+
.. code-block:: bash
52+
53+
# Create kernel-centric index (list of all kernels)
54+
./kernel_indexer collate-by-kernels --kernel-root /path/to/repository --language Python --output collated_manifests.json
55+
56+
# Create package-centric index (which kernels contain each package)
57+
./kernel_indexer collate-by-packages --kernel-root /path/to/repository --language Python --output package_index.json
58+
59+
# Or create both at once
60+
./kernel_indexer collate --kernel-root /path/to/repository --language Python --output-dir /path/to/output
61+
2862
.. note::
2963
Detailed step-by-step instructions for creating Python kernels are available in the kernel creation documentation.

documentation/source/maintainer/r_kernels.rst

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,38 @@ Before distributing kernels, ensure they:
3131
- Pass validation tests
3232

3333
.. note::
34-
Detailed step-by-step instructions for creating R kernels are available in the kernel creation documentation.
34+
Detailed step-by-step instructions for creating R kernels are available in the kernel creation documentation.
35+
36+
Indexing Kernels
37+
----------------
38+
39+
The ``kernel_indexer`` script can be used to create package manifests and inventory all kernels in a repository. This is useful for:
40+
41+
- Tracking which packages are included in each kernel
42+
- Generating package inventories for documentation
43+
- Creating indexes for package discovery
44+
45+
To index all R kernels in a repository:
46+
47+
.. code-block:: bash
48+
49+
./kernel_indexer index --kernel-root /path/to/repository --language R
50+
51+
This creates a ``package_manifest.json`` file in each kernel directory containing:
52+
- Kernel name and version
53+
- Language and language version
54+
- Complete list of packages with versions and sources
55+
- Indexing timestamp
56+
57+
To create collated indexes for all kernels:
58+
59+
.. code-block:: bash
60+
61+
# Create kernel-centric index (list of all kernels)
62+
./kernel_indexer collate-by-kernels --kernel-root /path/to/repository --language R --output collated_manifests.json
63+
64+
# Create package-centric index (which kernels contain each package)
65+
./kernel_indexer collate-by-packages --kernel-root /path/to/repository --language R --output package_index.json
66+
67+
# Or create both at once
68+
./kernel_indexer collate --kernel-root /path/to/repository --language R --output-dir /path/to/output

documentation/source/reference.rst

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,63 @@ Subcommands
7171
7272
(Not yet implemented) Update a checked-out kernel to the latest version from the central repository.
7373

74+
Kernel Indexer
75+
---------------
76+
77+
The ``kernel_indexer`` script indexes kernels and generates package manifests for inventory and management purposes.
78+
79+
**index**
80+
81+
.. code-block:: bash
82+
83+
./kernel_indexer index --kernel-root <PATH> [--language <LANG>] [--kernel-name <NAME>] [--kernel-version <VER>]
84+
85+
Index kernels and generate manifest files. Discovers all kernels in the repository and extracts package information from conda environments and language-specific package managers (e.g., R packages).
86+
87+
- ``--kernel-root``: Path to kernel repository root (required if not in config)
88+
- ``--language``: Filter by specific language (R, Python). If omitted, processes all languages
89+
- ``--kernel-name``: Index only a specific kernel (optional)
90+
- ``--kernel-version``: Index only a specific version (requires --kernel-name)
91+
92+
**collate-by-kernels**
93+
94+
.. code-block:: bash
95+
96+
./kernel_indexer collate-by-kernels --kernel-root <PATH> [--language <LANG>] [--output <PATH>]
97+
98+
Collate all manifest files into a kernel-centric index. Creates a JSON file listing all indexed kernels with their metadata and package counts.
99+
100+
- ``--kernel-root``: Path to kernel repository root (required if not in config)
101+
- ``--language``: Filter by specific language (R, Python). If omitted, processes all languages
102+
- ``--output``: Path for collated manifest (default: {kernel-root}/collated_manifests.json)
103+
104+
**collate-by-packages**
105+
106+
.. code-block:: bash
107+
108+
./kernel_indexer collate-by-packages --kernel-root <PATH> [--language <LANG>] [--output <PATH>]
109+
110+
Collate manifests into a package-centric index. Creates a JSON file listing all packages with information about which kernels contain them.
111+
112+
- ``--kernel-root``: Path to kernel repository root (required if not in config)
113+
- ``--language``: Filter by specific language (R, Python). If omitted, processes all languages
114+
- ``--output``: Path for package-centric index (default: {kernel-root}/package_index.json)
115+
116+
**collate**
117+
118+
.. code-block:: bash
119+
120+
./kernel_indexer collate --kernel-root <PATH> [--language <LANG>] [--output-dir <DIR>]
121+
122+
Run both collate-by-kernels and collate-by-packages operations. Creates both index files in the specified output directory.
123+
124+
- ``--kernel-root``: Path to kernel repository root (required if not in config)
125+
- ``--language``: Filter by specific language (R, Python). If omitted, processes all languages
126+
- ``--output-dir``: Directory for output files (default: {kernel-root})
127+
74128
For help, run:
75129
76130
.. code-block:: bash
77131
78-
./icrn_manager help
132+
./icrn_manager help
133+
./kernel_indexer

0 commit comments

Comments
 (0)