Skip to content

Commit e551f6c

Browse files
committed
Code generators return language and science command
1 parent b83131b commit e551f6c

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

servicex_codegen/post_operation.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2727
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
#
29-
29+
import json
3030
#
3131
# Redistribution and use in source and binary forms, with or without
3232
# modification, are permitted provided that the following conditions are met:
@@ -85,6 +85,10 @@ def stream_generated_code(self, generated_code_result: GeneratedFileResult) -> b
8585

8686
def post(self):
8787
try:
88+
with open("transformer_capabilities.json") as capabilities_file:
89+
capabilities = json.load(capabilities_file)
90+
print("capable", capabilities['language'], capabilities['command'])
91+
8892
with TemporaryDirectory() as tempdir:
8993
body = request.get_json()
9094
generated_code_result = self.code_generator.generate_code(
@@ -99,6 +103,8 @@ def post(self):
99103
# them into a multipart mime data type
100104
m = MultipartEncoder(
101105
fields={'transformer_image': transformer_image,
106+
'language': capabilities['language'],
107+
'command': capabilities['command'],
102108
'zip_data': zip_data}
103109
)
104110

tests/test_post_operation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_post_good_query_with_params(self, mocker):
8686
decoder_parts = decoder.MultipartDecoder(response.data, content_type)
8787

8888
transformer_image = str(decoder_parts.parts[0].content, 'utf-8')
89-
zip_file = decoder_parts.parts[1].content
89+
zip_file = decoder_parts.parts[3].content
9090

9191
print("Transformer Image: ", transformer_image)
9292
print("Zip File: ", zip_file)
@@ -131,7 +131,7 @@ def test_post_good_query_without_params(self, mocker):
131131
decoder_parts = decoder.MultipartDecoder(response.data, content_type)
132132

133133
transformer_image = str(decoder_parts.parts[0].content, 'utf-8')
134-
zip_file = decoder_parts.parts[1].content
134+
zip_file = decoder_parts.parts[3].content
135135

136136
print("Transformer Image: ", transformer_image)
137137
print("Zip File: ", zip_file)

transformer_capabilities.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "FuncADL based uproot transformer",
3+
"description": "Extracts data from flat ntuple style root files.",
4+
"limitations": "Would be good to note what isn't implemented",
5+
"file-formats": ["parquet"],
6+
"stats-parser": "UprootStats",
7+
"language": "python",
8+
"command": "/generated/transform_single_file.py"
9+
}

0 commit comments

Comments
 (0)