Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Add domain for HTTP-based lesson guides like jupyter notebooks in the livelesson response #177

Merged
merged 4 commits into from
May 3, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## In development

- Add domain for HTTP-based lesson guides like jupyter notebooks in the livelesson response [#177](https://github.com/nre-learning/antidote-core/pull/177)

## v0.6.1 - May 03, 2020

Expand Down
15 changes: 8 additions & 7 deletions api/exp/definitions/livelesson.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,17 @@ message LiveLesson {
int32 CurrentStage = 6;
string GuideContents = 7;
string GuideType = 8;
string GuideDomain = 9;

string Status = 9;
string Status = 10;

bool Error = 10;
int32 HealthyTests = 11;
int32 TotalTests = 12;
bool Error = 11;
int32 HealthyTests = 12;
int32 TotalTests = 13;

string Diagram = 13;
string Video = 14;
string StageVideo = 15;
string Diagram = 14;
string Video = 15;
string StageVideo = 16;
}

message LiveLessons {
Expand Down
3 changes: 3 additions & 0 deletions api/exp/definitions/livelesson.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@
"GuideType": {
"type": "string"
},
"GuideDomain": {
"type": "string"
},
"Status": {
"type": "string"
},
Expand Down
15 changes: 10 additions & 5 deletions api/exp/livelessons.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,16 @@ func (s *AntidoteAPI) RequestLiveLesson(ctx context.Context, lp *pb.LiveLessonRe
}

newLL := &models.LiveLesson{
ID: newID,
SessionID: lp.SessionId,
AntidoteID: s.Config.InstanceID,
LessonSlug: lp.LessonSlug,
GuideType: string(lesson.Stages[lp.LessonStage].GuideType),
ID: newID,
SessionID: lp.SessionId,
AntidoteID: s.Config.InstanceID,
LessonSlug: lp.LessonSlug,
GuideType: string(lesson.Stages[lp.LessonStage].GuideType),

// The front-end will only use this if GuideType is jupyter, but since it will not change, it makes
// sense to just set it here.
// TODO(mierdin): This needs to be coordinated with the creation of the jupyter ingress in requests.go
GuideDomain: fmt.Sprintf("%s-jupyterlabguide-web.%s", nsName, s.Config.HEPSDomain),
LiveEndpoints: liveEndpoints,
CurrentStage: lp.LessonStage,
Status: models.Status_INITIALIZED,
Expand Down
3 changes: 3 additions & 0 deletions api/exp/swagger/swagger.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,9 @@ Livelesson = `{
"GuideType": {
"type": "string"
},
"GuideDomain": {
"type": "string"
},
"Status": {
"type": "string"
},
Expand Down
1 change: 1 addition & 0 deletions db/models/livelesson.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type LiveLesson struct {
CurrentStage int32 `json:"LessonStage"`
GuideContents string `json:"GuideContents"`
GuideType string `json:"GuideType"`
GuideDomain string `json:"GuideDomain"`
Status LiveLessonStatus `json:"Status"`
CreatedTime time.Time `json:"CreatedTime"`
Error bool `json:"Error"`
Expand Down
7 changes: 5 additions & 2 deletions scheduler/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,16 @@ func (s *AntidoteScheduler) createK8sStuff(sc ot.SpanContext, req services.Lesso
}
ll.LiveEndpoints[jupyterEp.Name] = jupyterEp

nsName := generateNamespaceName(s.Config.InstanceID, req.LiveLessonID)

_, err := s.createIngress(
span.Context(),
ns.ObjectMeta.Name,
jupyterEp,
&models.LivePresentation{
Name: "web",
Port: 8888,
Name: "web",
Port: 8888,
HepDomain: fmt.Sprintf("%s-jupyterlabguide-web.%s", nsName, s.Config.HEPSDomain),
},
)
if err != nil {
Expand Down