Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added tracking model run time #2

Merged
merged 8 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
12 changes: 11 additions & 1 deletion ersilia/core/tracking.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
from datetime import datetime
import pandas as pd


class RunTracker:
"""
This class will be responsible for tracking model runs. It calculates the desired metadata based on a model's
inputs, outputs, and other run-specific features, before uploading them to Ersilia's Splunk dashboard.

NOTE: Currently, the Splunk connection is not set up. For now, we will print tracking results to the console.
"""
time_start = None
ericwang1409 marked this conversation as resolved.
Show resolved Hide resolved
# def __init__(self):
# self.time_start = None

# function to be called before model is run
def start_tracking(self):
self.time_start = datetime.now()

def read_csv(self, file):
# reads csv file and returns Pandas dataframe
Expand All @@ -25,3 +32,6 @@ def track(self, input, result, meta):
print(self.read_csv(result))

print("Model metadata:", meta)

time = datetime.now() - self.time_start
print("Time taken:", time)
5 changes: 5 additions & 0 deletions my_molecules.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Nc1ccc(cc1)S(N)(=O)=O
C[C@H](CSC(C)=O)C(=O)N1CCC[C@H]1C(=O)N[C@@H](Cc1ccccc1)C(O)=O
COc1ccc(Cl)c(Nc2ncnc3cc(OCC4CCN(C)CC4)c(OC)cc23)c1
C(N1CCCNCCNCCCNCC1)c1ccc(CN2CCCNCCNCCCNCC2)cc1
CC(C)NC[C@H](O)COc1cccc2ccccc12
6 changes: 6 additions & 0 deletions my_molecules_output.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
key,input,mw
FDDDEECHVMSUSB-UHFFFAOYSA-N,Nc1ccc(cc1)S(N)(=O)=O,172.20899999999997
FHHHOYXPRDYHEZ-COXVUDFISA-N,C[C@H](CSC(C)=O)C(=O)N1CCC[C@H]1C(=O)N[C@@H](Cc1ccccc1)C(O)=O,406.5040000000001
WPOXAFXHRJYEIC-UHFFFAOYSA-N,COc1ccc(Cl)c(Nc2ncnc3cc(OCC4CCN(C)CC4)c(OC)cc23)c1,442.94700000000034
YIQPUIGJQJDJOS-UHFFFAOYSA-N,C(N1CCCNCCNCCCNCC1)c1ccc(CN2CCCNCCNCCCNCC2)cc1,502.79600000000045
AQHHHDLHHXJYJD-AWEZNQCLSA-N,CC(C)NC[C@H](O)COc1cccc2ccccc12,259.34900000000005