Skip to content

Commit

Permalink
Merge branch 'master' into unittestneg
Browse files Browse the repository at this point in the history
  • Loading branch information
DhanshreeA authored Oct 23, 2024
2 parents 7be243c + bdddfb2 commit 05f752e
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions ersilia/publish/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,44 +257,42 @@ def check_dependencies_are_valid(self):
return Result(True, "Check passed.")
return Result(False, details)


def check_comptuational_performance(self):
"""
Measure computational performance by serving the model and running predictions.
Returns:
Uses --track flag to automatically upload performance metrics to S3.
Returns:
Result: A namedtuple containing a boolean success status and details of the check.
"""
details = ""

for n in (1, 10, 100):

cmd = (
f"ersilia serve {self.model} && "
f"ersilia serve {self.model} --track && " # Track flag enables automatic S3 upload of metrics
f"ersilia example -f my_input.csv -n {n} && "
"ersilia run -i my_input.csv && "
"ersilia close"
)

startTime = time.time()

process = subprocess.run(
cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)

if process.returncode != 0:
return Result(
False, f"Error serving model: {process.stdout}, {process.stderr}"
)

return Result(False, f"Error serving model: {process.stdout}, {process.stderr}")

endTime = time.time()

executionTime = endTime - startTime
details += f"Execution time ({n} Prediction(s)): {executionTime} seconds. "

return Result(True, details)

def check_no_extra_files(self):
Expand Down

0 comments on commit 05f752e

Please sign in to comment.