Skip to content

Commit

Permalink
Fix function. Update date format.
Browse files Browse the repository at this point in the history
  • Loading branch information
petya-vasileva committed Nov 8, 2023
1 parent 8c0b5c4 commit f59f836
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions ps-packetloss.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def query4Avg(dateFrom, dateTo):
"range" : {
"timestamp" : {
"gt" : dateFrom,
"lte": dateTo
"lte": dateTo,
"format": "epoch_millis"
}
}
},
Expand Down Expand Up @@ -134,8 +135,8 @@ def loadPacketLossData(dateFrom, dateTo):
return pd.DataFrame(data)


def getPercentageMeasuresDone(grouped, tempdf):
measures_done = tempdf.groupby('pair').agg({'doc_count': 'sum'})
def getPercentageMeasuresDone(dataDf, dateFrom, dateTo):
measures_done = dataDf.groupby('pair').agg({'doc_count': 'sum'})

def findRatio(row, total_minutes):
if pd.isna(row['doc_count']):
Expand All @@ -147,9 +148,10 @@ def findRatio(row, total_minutes):
one_test_per_min = hp.CalcMinutes4Period(dateFrom, dateTo)
measures_done['tests_done'] = measures_done.apply(
lambda x: findRatio(x, one_test_per_min), axis=1)
grouped = pd.merge(grouped, measures_done, on='pair', how='left')

return grouped
merged = pd.merge(dataDf, measures_done, on='pair', how='left')

return merged


@timer
Expand Down
4 changes: 2 additions & 2 deletions ps-trace.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
date
python ps-trace.py
python routers.py
rc=$?; if [[ $rc != 0 ]]; then
echo "problem running traceroute. Exiting."
echo "problem running routers. Exiting."
exit $rc
fi

0 comments on commit f59f836

Please sign in to comment.