Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion servicex_codegen/post_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# 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 json
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -85,6 +85,10 @@ def stream_generated_code(self, generated_code_result: GeneratedFileResult) -> b

def post(self):
try:
with open("transformer_capabilities.json") as capabilities_file:
capabilities = json.load(capabilities_file)
print("capable", capabilities['language'], capabilities['command'])

with TemporaryDirectory() as tempdir:
body = request.get_json()
generated_code_result = self.code_generator.generate_code(
Expand All @@ -99,6 +103,8 @@ def post(self):
# them into a multipart mime data type
m = MultipartEncoder(
fields={'transformer_image': transformer_image,
'language': capabilities['language'],
'command': capabilities['command'],
'zip_data': zip_data}
)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_post_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_post_good_query_with_params(self, mocker):
decoder_parts = decoder.MultipartDecoder(response.data, content_type)

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

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

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

print("Transformer Image: ", transformer_image)
print("Zip File: ", zip_file)
Expand Down
9 changes: 9 additions & 0 deletions transformer_capabilities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "FuncADL based uproot transformer",
"description": "Extracts data from flat ntuple style root files.",
"limitations": "Would be good to note what isn't implemented",
"file-formats": ["parquet"],
"stats-parser": "UprootStats",
"language": "python",
"command": "/generated/transform_single_file.py"
}