Skip to content

Commit

Permalink
Merge branch 'master' into no-local-model-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DhanshreeA committed Jun 26, 2024
2 parents 089ad55 + 2e5c39d commit 7666ded
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dockerfiles/model-deploy-v2/model/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ersiliaos/base-v2:latest as build
FROM ersiliaos/base-v2:latest AS build
ARG MODEL=eos_identifier
ENV MODEL=$MODEL
RUN ersilia -v fetch $MODEL --from_github
Expand Down
25 changes: 23 additions & 2 deletions ersilia/core/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import logging
import requests
import tempfile
import types
import resource
import statistics
import tracemalloc
Expand Down Expand Up @@ -536,7 +537,27 @@ def track(self, input, result, meta):
self.docker_client = SimpleDocker()
json_dict = {}
input_data = read_csv(input)
result_data = read_csv(result)
# Create a temporary file to store the result if it is a generator
if isinstance(result, types.GeneratorType):

# Ensure EOS/tmp directory exists
tmp_dir = os.path.join(EOS, "tmp")
if not os.path.exists(tmp_dir):
os.makedirs(tmp_dir, exist_ok=True)

# Create a temporary file to store the generator output
temp_output_file = tempfile.NamedTemporaryFile(
delete=False, suffix=".csv", dir=tmp_dir
)
temp_output_path = temp_output_file.name
with open(temp_output_path, "w", newline="") as csvfile:
csvWriter = csv.writer(csvfile)
for row in result:
csvWriter.writerow(row)
result_data = read_csv(temp_output_path)
os.remove(temp_output_path)
else:
result_data = read_csv(result)

session = Session(config_json=self.config_json)
model_id = meta["metadata"].get("Identifier", "Unknown")
Expand Down Expand Up @@ -579,4 +600,4 @@ def track(self, input, result, meta):
def log(self, result, meta):
self.log_result(result)
self.log_meta(meta)
self.log_logs()
self.log_logs()

0 comments on commit 7666ded

Please sign in to comment.