Skip to content

Commit ac24c07

Browse files
authored
Merge pull request #101 from dataiku/task/get-scenarios-by-date-range
Add method to get scenario runs between two dates
2 parents 1433ba6 + f478b19 commit ac24c07

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

dataikuapi/dss/scenario.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ def get_last_runs(self, limit=10, only_finished_runs=False):
6363
})
6464
return [DSSScenarioRun(self.client, run) for run in runs]
6565

66+
def get_runs_by_date(self, from_date, to_date):
67+
"""
68+
Get the list of runs of the scenario within the two dates provided [from_date, to_date)
69+
70+
:param datetime.date from_date: The first date of the range, inclusive
71+
:param datetime.date to_date: The last date of the range, exclusive
72+
:return: A list of :class:`dataikuapi.dss.scenario.DSSScenarioRun`
73+
"""
74+
runs = self.client._perform_json(
75+
"GET", "/projects/%s/scenarios/%s/get-runs-by-date" % (self.project_key, self.id), params={
76+
'fromDate': from_date.isoformat(),
77+
'toDate': to_date.isoformat()
78+
})
79+
return [DSSScenarioRun(self.client, run) for run in runs]
80+
6681
def get_last_finished_run(self):
6782
"""
6883
Gets the last run that completed (successfully or not)

0 commit comments

Comments
 (0)