Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
34127c1
support custom TopCP images
MattShirley Sep 23, 2025
ba71014
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 23, 2025
86d536d
resolve flake8 issues
MattShirley Sep 23, 2025
b518d40
Revert "resolve flake8 issues"
MattShirley Sep 23, 2025
c185637
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Sep 23, 2025
8286d95
fix broken test
MattShirley Sep 23, 2025
2e706b7
add back allowed_repos logic
MattShirley Sep 23, 2025
fe976f3
remove accidental values changes
MattShirley Sep 23, 2025
e129256
moving towards MVP (app server is failing due to bad mount)
MattShirley Oct 8, 2025
0386476
update directory structure
MattShirley Oct 21, 2025
d0776b0
tighten flake8
MattShirley Oct 21, 2025
1cade42
Merge branch 'develop' of https://github.com/ssl-hep/ServiceX into 11…
MattShirley Oct 21, 2025
f1b7b43
remove comments and unused env vars
MattShirley Oct 21, 2025
8a4fbb7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 21, 2025
0fd050d
rewrite custom_docker_image logic
MattShirley Oct 23, 2025
2d3bf8f
Merge branch 'develop' of https://github.com/ssl-hep/ServiceX into 11…
MattShirley Oct 24, 2025
8fc3645
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Oct 28, 2025
d7bb6cd
add back runTop_el
MattShirley Oct 28, 2025
e5024d0
remove old test files
MattShirley Oct 28, 2025
0125f41
fix local volume mount
MattShirley Oct 29, 2025
b49b9ee
change reload to mountLocal
MattShirley Oct 29, 2025
f799896
Merge branch 'develop' of https://github.com/ssl-hep/ServiceX into 11…
MattShirley Oct 31, 2025
6686336
update helm charts and other config stuff
MattShirley Oct 31, 2025
0f4f3f4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2025
8aeff9e
resolve flake8
MattShirley Oct 31, 2025
c9aaf95
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Oct 31, 2025
981504b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2025
28523ed
move boot.sh
MattShirley Oct 31, 2025
c60e495
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Oct 31, 2025
ce26f8f
update boot.sh command
MattShirley Oct 31, 2025
6c2059f
update test coverage
MattShirley Oct 31, 2025
3dfd2ad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2025
5aa97d6
resolve flake8
MattShirley Oct 31, 2025
8aa6bf2
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Oct 31, 2025
8cce096
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2025
01c453a
resolve flake8 again
MattShirley Oct 31, 2025
91343d2
remove unneeded defaultBaseImage from values.yaml
MattShirley Nov 4, 2025
a172125
properly source app config values
MattShirley Nov 10, 2025
78ddeac
resolve flake8
MattShirley Nov 10, 2025
6bbd73b
update tests to use app.config
MattShirley Nov 10, 2025
1f20afe
resolve flake8
MattShirley Nov 10, 2025
f8b8dde
remove local dev related changes
MattShirley Nov 11, 2025
d03f8ba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 11, 2025
1098084
remove Procfile changes from this PR
MattShirley Nov 11, 2025
f9fe691
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Nov 11, 2025
cdc29c2
add topcp codegen values to reference.md
MattShirley Nov 11, 2025
e2e076c
correct topcp pullpolicy
MattShirley Nov 11, 2025
1b140d0
move custom image logic to topcp codegen
MattShirley Nov 13, 2025
eea313b
move boot.sh back
MattShirley Nov 13, 2025
e348931
remove comment
MattShirley Nov 13, 2025
2ba1a2a
move docker image validation tests to codegen
MattShirley Nov 13, 2025
50c542c
flake8/black
MattShirley Nov 13, 2025
5fc9d75
flake8
MattShirley Nov 13, 2025
c45ad9f
revert submit.py
MattShirley Nov 13, 2025
7141637
remove TOPCP_CUSTOM_IMAGES from app template
MattShirley Nov 13, 2025
1d9fab9
remove custom_image from generate_code_for_selection
MattShirley Nov 13, 2025
4cca0aa
flake8
MattShirley Nov 13, 2025
c688ece
add new codegen topcp custom docker image test
MattShirley Nov 13, 2025
c956c90
update test
MattShirley Nov 13, 2025
8a1d8a5
add json parsing check to topcp codegen startup
MattShirley Nov 13, 2025
2a5f730
check to make sure allowed_images_json is truthy
MattShirley Nov 13, 2025
53448d8
Merge branch 'develop' into 1162-support-custom-topcp-images
MattShirley Nov 14, 2025
32293b5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 14, 2025
19601a7
cleanup merge conflict
MattShirley Nov 14, 2025
c0ad867
Merge branch 'develop' of https://github.com/ssl-hep/ServiceX into 11…
MattShirley Dec 3, 2025
7bb2e9b
add support for non-docker.io registries
MattShirley Dec 16, 2025
70a41b3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 16, 2025
1682aa6
resolve flake8
MattShirley Dec 16, 2025
0961f74
update broken test hash
MattShirley Dec 16, 2025
9b235a0
improve code coverage
MattShirley Dec 16, 2025
904d6eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 16, 2025
c106743
update tests and remove old TOPCP_ALLOWED_IMAGES
MattShirley Dec 16, 2025
286703f
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Dec 16, 2025
96e4705
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 16, 2025
186533e
update tests
MattShirley Dec 16, 2025
a568a08
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Dec 16, 2025
270cdbb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 16, 2025
423df75
resolve flake8
MattShirley Dec 16, 2025
94e9615
move custom docker image validation to servicex_app
MattShirley Dec 17, 2025
7a5c412
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 17, 2025
229ac89
remove old TopCP tests
MattShirley Dec 17, 2025
d25187a
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Dec 17, 2025
dc243f3
remove unneeded test
MattShirley Dec 18, 2025
7f10cc8
attempt to fix breaking test
MattShirley Dec 18, 2025
cfc7a61
add ALLOWED_DOCKER_REGISTRIES to resource_test_base
MattShirley Dec 18, 2025
91b7a03
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 18, 2025
9684db4
fix environment vars in deployments
MattShirley Dec 18, 2025
aef2fba
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Dec 18, 2025
3705c04
correct ALLOWED_DOCKER_REGISTRIES test setting
MattShirley Dec 18, 2025
0b805b4
add ALLOWED_DOCKER_REGISTRIES to test_read_from_config
MattShirley Dec 18, 2025
e469629
resolve linting issue
MattShirley Dec 18, 2025
563750d
improve code coverage
MattShirley Dec 18, 2025
46447d9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 18, 2025
2e66b34
resolve flake8
MattShirley Dec 18, 2025
7785682
update documentation
MattShirley Jan 8, 2026
3d1f92f
resolve merge conflict
MattShirley Jan 9, 2026
8b27d94
replace bespoke registry APIs to validate docker images, instead use …
MattShirley Jan 12, 2026
e01ff98
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 12, 2026
6fd1bd0
mock crane subprocess call so tests pass without network access
MattShirley Jan 12, 2026
eebcf92
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Jan 12, 2026
86cc261
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 12, 2026
875f7e3
Merge branch 'develop' of https://github.com/ssl-hep/ServiceX into 11…
MattShirley Jan 14, 2026
661e4a0
separate custom image logic better between submit.py and TopCP code gen
MattShirley Jan 14, 2026
4848d90
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Jan 14, 2026
d6e0121
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2026
888ead7
add cache to and updates tests
MattShirley Jan 14, 2026
1c440ba
improve code coverage with new tests
MattShirley Jan 14, 2026
c5bf395
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2026
760a6f7
remove registry in favor of just image keyword
MattShirley Jan 15, 2026
78d7337
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Jan 15, 2026
03367c8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 15, 2026
8053d3b
remove final registry references
MattShirley Jan 16, 2026
0b80225
Merge branch '1162-support-custom-topcp-images' of https://github.com…
MattShirley Jan 16, 2026
53b3af0
fix test_src.py broken test
MattShirley Jan 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
minikube-mount: minikube mount $LOCAL_DIR:/mnt/servicex
minikube-mount-app: minikube mount $LOCAL_DIR:/mnt/servicex
minikube-mount-topcp: minikube mount $LOCAL_DIR/code_generator_TopCPToolkit:/mnt/topcp
helm-install: sleep 5; cd $CHART_DIR && helm install -f $VALUES_FILE servicex . && tail -f /dev/null
port-forward-app: sleep 30 && cd $LOCAL_DIR && bash local/port-forward.sh app
port-forward-minio: sleep 20 && cd $LOCAL_DIR && bash local/port-forward.sh minio
Expand Down
Empty file modified code_generator_TopCPToolkit/boot.sh
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import os

options = {
Expand Down Expand Up @@ -36,12 +35,15 @@
"ifTrue": ["--no-filter"],
"ifFalse": None,
},
"image": {
"properType": str,
"properTypeString": "string",
"optional": True,
},
}


def generate_files_from_query(query, query_file_path):
jquery = json.loads(query)

def generate_files_from_query(jquery: dict, query_file_path):
runTopCommand = [
"runTop_el.py",
"-i",
Expand All @@ -52,16 +54,19 @@ def generate_files_from_query(query, query_file_path):
"customConfig",
]

# ensure all keys are specified
# ensure all required keys are specified
for key in options:
if key not in jquery:
# Skip optional parameters
if options[key].get("optional", False):
continue
raise ValueError(
key + " must be specified. May be type None or ",
options[key]["properTypeString"],
)

for key in jquery:
# ensure only aviable options are allowed
# ensure only available options are allowed
if key not in options:
raise KeyError(
key + " is not implemented. Available keys: " + str(options.keys())
Expand All @@ -78,7 +83,7 @@ def generate_files_from_query(query, query_file_path):
)

# check for reco.yaml, parton.yaml and particle.yaml files
if isinstance(jquery[key], str):
if isinstance(jquery[key], str) and "fileName" in options[key]:
with open(
os.path.join(query_file_path, options[key]["fileName"]), "w"
) as file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os
import json
import shutil

from . import query_translate
from servicex_codegen.code_generator import (
CodeGenerator,
Expand Down Expand Up @@ -62,11 +64,18 @@ def generate_code(self, query, cache_path: str):
capabilities_path = os.environ.get(
"CAPABILITIES_PATH", "/home/servicex/transformer_capabilities.json"
)

jquery = json.loads(query)
query_translate.generate_files_from_query(jquery, query_file_path)

shutil.copyfile(
capabilities_path,
os.path.join(query_file_path, "transformer_capabilities.json"),
)

query_translate.generate_files_from_query(query, query_file_path)
results = GeneratedFileResult(_hash, query_file_path)

if jquery.get("image"):
results.image = jquery["image"]

return GeneratedFileResult(_hash, query_file_path)
return results
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,23 @@ def transform_single_file(file_path: str, output_path: Path, output_format: str)
# create input.txt file for event loop and insert file_path as only line
with open("input.txt", "w") as f:
f.write(file_path)
# move reco.yaml, parton.yaml and particle.yaml if they exit to CONFIG_LOC loacation

# move reco.yaml, parton.yaml and particle.yaml if they exist to CONFIG_LOC location
config_loc = os.environ.get("CONFIG_LOC", os.getcwd())
if os.path.exists("/generated/reco.yaml"):
shutil.copyfile(
"/generated/reco.yaml",
os.path.join(os.environ.get("CONFIG_LOC"), "reco.yaml"),
os.path.join(config_loc, "reco.yaml"),
)
if os.path.exists("/generated/parton.yaml"):
shutil.copyfile(
"/generated/parton.yaml",
os.path.join(os.environ.get("CONFIG_LOC"), "parton.yaml"),
os.path.join(config_loc, "parton.yaml"),
)
if os.path.exists("/generated/particle.yaml"):
shutil.copyfile(
"/generated/particle.yaml",
os.path.join(os.environ.get("CONFIG_LOC"), "particle.yaml"),
os.path.join(config_loc, "particle.yaml"),
)

generated_transformer.runTop_el()
Expand Down
92 changes: 92 additions & 0 deletions code_generator_TopCPToolkit/tests/test_src.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,98 @@ def test_generate_code():
translator.generate_code(query, tmpdirname)


def test_generate_code_fails_with_unknown_selection_key():
os.environ["TEMPLATE_PATH"] = "servicex/templates/transform_single_file.py"
os.environ["CAPABILITIES_PATH"] = "transformer_capabilities.json"

with tempfile.TemporaryDirectory() as tmpdirname:
translator = TopCPTranslator()
query = (
'{"reco": "CommonServices:\\n systematicsHistogram: \'listOfSystematics\'\\n\\n'
"PileupReweighting: {}\\n\\nEventCleaning:\\n runEventCleaning: False\\n"
" runGRL: False\\n\\nElectrons:\\n - containerName: 'AnaElectrons'\\n"
" crackVeto: True\\n IFFClassification: {}\\n WorkingPoint:\\n"
" - selectionName: 'loose'\\n identificationWP: 'TightLH'\\n"
" isolationWP: 'NonIso'\\n noEffSF: True\\n"
" - selectionName: 'tight'\\n identificationWP: 'TightLH'\\n"
" isolationWP: 'Tight_VarRad'\\n noEffSF: True\\n"
" PtEtaSelection:\\n minPt: 25000.0\\n maxEta: 2.47\\n"
" useClusterEta: True\\n\\n"
"# After configuring each container, many variables will be saved automatically.\\n"
"Output:\\n treeName: 'reco'\\n vars: []\\n metVars: []\\n containers:\\n"
" # Format should follow: '<suffix>:<output container>'\\n"
" el_: 'AnaElectrons'\\n '': 'EventInfo'\\n commands:\\n"
" # Turn output branches on and off with 'enable' and 'disable'\\n\\n"
'AddConfigBlocks: []\\n", "parton": null, "particle": null, "max_events": 100, '
'"no_systematics": true, "no_filter": false, "unknown_key": "unknown_value"}'
)

with pytest.raises(KeyError):
translator.generate_code(query, tmpdirname)


def test_generate_code_fails_with_missing_required_selection_key():
os.environ["TEMPLATE_PATH"] = "servicex/templates/transform_single_file.py"
os.environ["CAPABILITIES_PATH"] = "transformer_capabilities.json"

with tempfile.TemporaryDirectory() as tmpdirname:
translator = TopCPTranslator()
query = (
'{"reco": "CommonServices:\\n systematicsHistogram: \'listOfSystematics\'\\n\\n'
"PileupReweighting: {}\\n\\nEventCleaning:\\n runEventCleaning: False\\n"
" runGRL: False\\n\\nElectrons:\\n - containerName: 'AnaElectrons'\\n"
" crackVeto: True\\n IFFClassification: {}\\n WorkingPoint:\\n"
" - selectionName: 'loose'\\n identificationWP: 'TightLH'\\n"
" isolationWP: 'NonIso'\\n noEffSF: True\\n"
" - selectionName: 'tight'\\n identificationWP: 'TightLH'\\n"
" isolationWP: 'Tight_VarRad'\\n noEffSF: True\\n"
" PtEtaSelection:\\n minPt: 25000.0\\n maxEta: 2.47\\n"
" useClusterEta: True\\n\\n"
"# After configuring each container, many variables will be saved automatically.\\n"
"Output:\\n treeName: 'reco'\\n vars: []\\n metVars: []\\n containers:\\n"
" # Format should follow: '<suffix>:<output container>'\\n"
" el_: 'AnaElectrons'\\n '': 'EventInfo'\\n commands:\\n"
" # Turn output branches on and off with 'enable' and 'disable'\\n\\n"
'AddConfigBlocks: []\\n", "parton": null, "particle": null, "max_events": 100, '
'"no_systematics": true}'
)

with pytest.raises(ValueError):
translator.generate_code(query, tmpdirname)


def test_generate_code_with_custom_image():
"""Test that custom image is properly set in the result"""
os.environ["TEMPLATE_PATH"] = "servicex/templates/transform_single_file.py"
os.environ["CAPABILITIES_PATH"] = "transformer_capabilities.json"

with tempfile.TemporaryDirectory() as tmpdirname:
translator = TopCPTranslator()
query = (
'{"reco": "CommonServices:\\n systematicsHistogram: \'listOfSystematics\'\\n\\n'
"PileupReweighting: {}\\n\\nEventCleaning:\\n runEventCleaning: False\\n"
" runGRL: False\\n\\nElectrons:\\n - containerName: 'AnaElectrons'\\n"
" crackVeto: True\\n IFFClassification: {}\\n WorkingPoint:\\n"
" - selectionName: 'loose'\\n identificationWP: 'TightLH'\\n"
" isolationWP: 'NonIso'\\n noEffSF: True\\n"
" - selectionName: 'tight'\\n identificationWP: 'TightLH'\\n"
" isolationWP: 'Tight_VarRad'\\n noEffSF: True\\n"
" PtEtaSelection:\\n minPt: 25000.0\\n maxEta: 2.47\\n"
" useClusterEta: True\\n\\n"
"# After configuring each container, many variables will be saved automatically.\\n"
"Output:\\n treeName: 'reco'\\n vars: []\\n metVars: []\\n containers:\\n"
" # Format should follow: '<suffix>:<output container>'\\n"
" el_: 'AnaElectrons'\\n '': 'EventInfo'\\n commands:\\n"
" # Turn output branches on and off with 'enable' and 'disable'\\n\\n"
'AddConfigBlocks: []\\n", "parton": null, "particle": null, "max_events": 100, '
'"no_systematics": true, "no_filter": false, '
'"image": "custom/topcp:v1.0"}'
)

result = translator.generate_code(query, tmpdirname)
assert result.image == "custom/topcp:v1.0"


def test_app():
import servicex.TopCP_code_generator

Expand Down
Loading