Skip to content

Commit

Permalink
Merge pull request flyteorg#45 from lyft/spark-submit
Browse files Browse the repository at this point in the history
Add logs links for Spark-Submit/other pods
  • Loading branch information
akhurana001 authored Jan 9, 2020
2 parents 91586fc + ea35b8e commit 26c1869
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 10 additions & 1 deletion go/tasks/plugins/k8s/spark/spark.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,18 @@ func getEventInfoForSpark(sj *sparkOp.SparkApplication) (*pluginsCore.TaskInfo,
Name: "System Logs (via Cloudwatch)",
MessageFormat: core.TaskLog_JSON,
}
allUserLogs := core.TaskLog{
Uri: fmt.Sprintf(
"https://console.aws.amazon.com/cloudwatch/home?region=%s#logStream:group=%s;prefix=var.log.containers.%s;streamFilter=typeLogStreamPrefix",
logConfig.CloudwatchRegion,
logConfig.CloudwatchLogGroup,
sj.Name),
Name: "Spark-Submit/All User Logs (via Cloudwatch)",
MessageFormat: core.TaskLog_JSON,
}
taskLogs = append(taskLogs, &cwUserLogs)
taskLogs = append(taskLogs, &cwSystemLogs)

taskLogs = append(taskLogs, &allUserLogs)
}

// Spark UI.
Expand Down
6 changes: 4 additions & 2 deletions go/tasks/plugins/k8s/spark/spark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func TestGetEventInfo(t *testing.T) {
assert.Equal(t, "k8s.com/#!/log/spark-namespace/spark-pod/pod?namespace=spark-namespace", info.Logs[0].Uri)
assert.Equal(t, "https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logStream:group=/kubernetes/flyte;prefix=var.log.containers.spark-pod;streamFilter=typeLogStreamPrefix", info.Logs[1].Uri)
assert.Equal(t, "https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logStream:group=/kubernetes/flyte;prefix=system_log.var.log.containers.spark-app-name;streamFilter=typeLogStreamPrefix", info.Logs[2].Uri)
assert.Equal(t, "https://spark-ui.flyte", info.Logs[3].Uri)
assert.Equal(t, "https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logStream:group=/kubernetes/flyte;prefix=var.log.containers.spark-app-name;streamFilter=typeLogStreamPrefix", info.Logs[3].Uri)
assert.Equal(t, "https://spark-ui.flyte", info.Logs[4].Uri)

assert.NoError(t, setSparkConfig(&Config{
SparkHistoryServerURL: "spark-history.flyte",
Expand All @@ -82,7 +83,8 @@ func TestGetEventInfo(t *testing.T) {
assert.Equal(t, "k8s.com/#!/log/spark-namespace/spark-pod/pod?namespace=spark-namespace", info.Logs[0].Uri)
assert.Equal(t, "https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logStream:group=/kubernetes/flyte;prefix=var.log.containers.spark-pod;streamFilter=typeLogStreamPrefix", info.Logs[1].Uri)
assert.Equal(t, "https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logStream:group=/kubernetes/flyte;prefix=system_log.var.log.containers.spark-app-name;streamFilter=typeLogStreamPrefix", info.Logs[2].Uri)
assert.Equal(t, "spark-history.flyte/history/app-id", info.Logs[3].Uri)
assert.Equal(t, "https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logStream:group=/kubernetes/flyte;prefix=var.log.containers.spark-app-name;streamFilter=typeLogStreamPrefix", info.Logs[3].Uri)
assert.Equal(t, "spark-history.flyte/history/app-id", info.Logs[4].Uri)
}

func TestGetTaskPhase(t *testing.T) {
Expand Down

0 comments on commit 26c1869

Please sign in to comment.