Skip to content

Commit

Permalink
pull shorter logs
Browse files Browse the repository at this point in the history
  • Loading branch information
xudifsd committed Nov 12, 2019
1 parent 2e88430 commit 6e6d003
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/k8sUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def GetPod(selector):
return podInfo


def GetLog(jobId):
def GetLog(jobId, tail=3000):
# assume our job only one container per pod.

selector = "run=" + jobId
Expand All @@ -194,7 +194,7 @@ def GetLog(jobId):
if "status" in item and "containerStatuses" in item["status"] and "containerID" in item["status"]["containerStatuses"][0]:
containerID = item["status"]["containerStatuses"][0]["containerID"].replace("docker://", "")
log["containerID"] = containerID
log["containerLog"] = kubectl_exec(" logs " + log["podName"])
log["containerLog"] = kubectl_exec(" logs %s --tail=%s" % (log["podName"], str(tail)))
logs.append(log)
return logs

Expand Down

0 comments on commit 6e6d003

Please sign in to comment.