Skip to content

Commit

Permalink
reorganized runtime environment record based on clamsproject/mmif#232
Browse files Browse the repository at this point in the history
  • Loading branch information
keighrim committed Jul 22, 2024
1 parent c208ee8 commit 7f51d57
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions clams/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ def annotate(self, mmif: Union[str, dict, Mmif], **runtime_params: List[str]) ->
runningTime = refined.get('runningTime', False)
hwFetch = refined.get('hwFetch', False)
runtime_recs = {}
if runningTime:
runtime_recs['runningTime'] = str(td)
if hwFetch:
import platform, shutil, subprocess
runtime_recs['architecture'] = platform.machine()
Expand All @@ -170,10 +168,13 @@ def annotate(self, mmif: Union[str, dict, Mmif], **runtime_params: List[str]) ->
stdout=subprocess.PIPE).stdout.decode('utf-8').strip().split('\n'):
name, mem = gpu.split(', ')
runtime_recs['cuda'].append(f'{name} ({mem})')
if len(runtime_recs) > 0:
for annotated_view in annotated.views:
if annotated_view.metadata.app == self.metadata.identifier:
annotated_view.metadata.set_additional_property('runtime', runtime_recs)
for annotated_view in annotated.views:
if annotated_view.metadata.app == self.metadata.identifier:
if runningTime:
annotated_view.metadata.set_additional_property('appRunningTime', str(td))
if len(runtime_recs) > 0:
annotated_view.metadata.set_additional_property('appRunningHardware', runtime_recs)

return annotated.serialize(pretty=pretty, sanitize=True)

@abstractmethod
Expand Down

0 comments on commit 7f51d57

Please sign in to comment.