Skip to content

Commit e0cf5d5

Browse files
Merge pull request #469 from OP-TED/feature/TED-1304
Update rml_mapper.py
2 parents c4e009d + 053ffae commit e0cf5d5

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

ted_sws/notice_transformer/adapters/rml_mapper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,17 @@ class RMLMapper(RMLMapperABC):
6161
"""
6262
This class is a concrete implementation of the rml-mapper adapter.
6363
"""
64-
def __init__(self, rml_mapper_path: Path, serialization_format: SerializationFormat = TURTLE_SERIALIZATION_FORMAT):
64+
def __init__(self, rml_mapper_path: Path, serialization_format: SerializationFormat = TURTLE_SERIALIZATION_FORMAT,
65+
transformation_timeout: float = None
66+
):
6567
"""
6668
:param rml_mapper_path: the path to the rml-mapper executable
6769
:param serialization_format: serialization format
70+
:param serialization_format: transformation_timeout
6871
"""
6972
self.rml_mapper_path = rml_mapper_path
7073
self.serialization_format = serialization_format
74+
self.transformation_timeout = transformation_timeout
7175

7276
def execute(self, package_path: Path) -> str:
7377
"""
@@ -87,7 +91,7 @@ def execute(self, package_path: Path) -> str:
8791
"""
8892
# java -jar ./rmlmapper.jar -m rml.ttl -s turtle -o output.ttl
8993
bash_script = f"cd {package_path} && java -jar {self.rml_mapper_path} -m {package_path / MS_TRANSFORM_FOLDER_NAME / MS_MAPPINGS_FOLDER_NAME / '*'} -s {self.get_serialization_format_value()}"
90-
script_result = subprocess.run(bash_script, shell=True, capture_output=True)
94+
script_result = subprocess.run(bash_script, shell=True, capture_output=True, timeout=self.transformation_timeout)
9195
error = script_result.stderr.decode('utf-8')
9296
if error:
9397
raise Exception(error)

0 commit comments

Comments
 (0)