-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Submit Argo workflow #1252
Submit Argo workflow #1252
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,7 +265,7 @@ func TestEnd2EndMySQL(t *testing.T) { | |
t.Fatalf("failed to generate CA pair %v", err) | ||
} | ||
|
||
go start(modelDir, caCrt, caKey, unitestPort) | ||
go start(modelDir, caCrt, caKey, unitestPort, false) | ||
waitPortReady(fmt.Sprintf("localhost:%d", unitestPort), 0) | ||
err = prepareTestData(dbConnStr) | ||
if err != nil { | ||
|
@@ -359,7 +359,7 @@ func TestEnd2EndHive(t *testing.T) { | |
t.Skip("Skipping hive tests") | ||
} | ||
dbConnStr = "hive://root:[email protected]:10000/iris?auth=NOSASL" | ||
go start(modelDir, caCrt, caKey, unitestPort) | ||
go start(modelDir, caCrt, caKey, unitestPort, false) | ||
waitPortReady(fmt.Sprintf("localhost:%d", unitestPort), 0) | ||
err = prepareTestData(dbConnStr) | ||
if err != nil { | ||
|
@@ -396,7 +396,7 @@ func TestEnd2EndMaxCompute(t *testing.T) { | |
SK := os.Getenv("MAXCOMPUTE_SK") | ||
endpoint := os.Getenv("MAXCOMPUTE_ENDPOINT") | ||
dbConnStr = fmt.Sprintf("maxcompute://%s:%s@%s", AK, SK, endpoint) | ||
go start(modelDir, caCrt, caKey, unitestPort) | ||
go start(modelDir, caCrt, caKey, unitestPort, false) | ||
waitPortReady(fmt.Sprintf("localhost:%d", unitestPort), 0) | ||
err = prepareTestData(dbConnStr) | ||
if err != nil { | ||
|
@@ -440,7 +440,7 @@ func TestEnd2EndMaxComputeALPS(t *testing.T) { | |
t.Fatalf("prepare test dataset failed: %v", err) | ||
} | ||
|
||
go start(modelDir, caCrt, caKey, unitestPort) | ||
go start(modelDir, caCrt, caKey, unitestPort, false) | ||
waitPortReady(fmt.Sprintf("localhost:%d", unitestPort), 0) | ||
|
||
t.Run("CaseTrainALPS", CaseTrainALPS) | ||
|
@@ -479,7 +479,7 @@ func TestEnd2EndMaxComputeElasticDL(t *testing.T) { | |
t.Fatalf("prepare test dataset failed: %v", err) | ||
} | ||
|
||
go start(modelDir, caCrt, caKey, unitestPort) | ||
go start(modelDir, caCrt, caKey, unitestPort, false) | ||
waitPortReady(fmt.Sprintf("localhost:%d", unitestPort), 0) | ||
|
||
t.Run("CaseTrainElasticDL", CaseTrainElasticDL) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,27 +10,29 @@ service SQLFlow { | |
// SQL statements like `SELECT ...`, `DESCRIBE ...` returns a rowset. | ||
// The rowset might be big. In such cases, Query returns a stream | ||
// of RunResponse | ||
// | ||
// SQLFlow implements the Run interface with two mode: | ||
// | ||
// 1. Local model | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will the "local mode" move to couler "docker mode"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
// The SQLFlow server execute the SQL statments on the local host. | ||
// | ||
// SQL statements like `USE database`, `DELETE` returns only a success | ||
// message. | ||
// | ||
// SQL statement like `SELECT ... TO TRAIN/PREDICT ...` returns a stream of | ||
// messages which indicates the training/predicting progress | ||
// | ||
// 2. Argo Workflow mode | ||
// The SQLFlow server submites an Argo workflow into a Kubernetes cluster, | ||
// and returns a stream of messages indicates the WorkFlow ID and the | ||
// submiting progress. | ||
// | ||
// The SQLFlow gRPC client should fetch the logs of the workflow by | ||
// calling the Fetch interface in a polling manner. | ||
rpc Run (Request) returns (stream Response); | ||
|
||
// Submit a SQLFlow Job which contains a SQL program to SQLFlow server. | ||
// | ||
// A SQL program contains one or more SQL statments. | ||
// Each of these SQL statments can be a standard SQL like: | ||
// `SELECT ... FROM ...;`, `DESCRIBE ...`, | ||
// or an extended SQLFlow SQL like: | ||
// `SELECT ... TO TRAIN/PREDICT/EXPLAIN ...`. | ||
// | ||
// Submit returns a Job message which contains the SQLFlow Job ID. | ||
rpc Submit (Request) returns (Job); | ||
|
||
// Fetch fetchs the SQLFlow job status and logs in a polling manner. | ||
rpc Fetch (Job) returns(JobStatus); | ||
rpc Fetch (Job) returns (JobStatus); | ||
} | ||
|
||
message Job { | ||
|
@@ -78,6 +80,7 @@ message Response { | |
Row row = 2; | ||
Message message = 3; | ||
EndOfExecution eoe = 4; | ||
Job job = 5; | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,8 @@ import ( | |
) | ||
|
||
// NewServer returns a server instance | ||
func NewServer(run func(string, *sf.DB, string, *pb.Session) *sf.PipeReader, modelDir string) *Server { | ||
func NewServer(run func(string, *sf.DB, string, *pb.Session) *sf.PipeReader, | ||
modelDir string) *Server { | ||
return &Server{run: run, modelDir: modelDir} | ||
} | ||
|
||
|
@@ -44,12 +45,6 @@ type Server struct { | |
modelDir string | ||
} | ||
|
||
// Submit implements `rpc Submit (Request) returns (Job)` | ||
func (s *Server) Submit(ctx context.Context, in *pb.Request) (*pb.Job, error) { | ||
job := &pb.Job{} | ||
return job, nil | ||
} | ||
|
||
// Fetch implements `rpc Fetch (Job) returns(JobStatus)` | ||
func (s *Server) Fetch(ctx context.Context, job *pb.Job) (*pb.JobStatus, error) { | ||
js := &pb.JobStatus{} | ||
|
@@ -59,6 +54,7 @@ func (s *Server) Fetch(ctx context.Context, job *pb.Job) (*pb.JobStatus, error) | |
// Run implements `rpc Run (Request) returns (stream Response)` | ||
func (s *Server) Run(req *pb.Request, stream pb.SQLFlow_RunServer) error { | ||
var db *sf.DB | ||
|
||
var err error | ||
if db, err = sf.NewDB(req.Session.DbConnStr); err != nil { | ||
return fmt.Errorf("create DB failed: %v", err) | ||
|
@@ -82,6 +78,9 @@ func (s *Server) Run(req *pb.Request, stream pb.SQLFlow_RunServer) error { | |
res, err = encodeRow(s) | ||
case string: | ||
res, err = encodeMessage(s) | ||
case sf.WorkflowJob: | ||
job := r.(sf.WorkflowJob) | ||
res = &pb.Response{Response: &pb.Response_Job{Job: &pb.Job{Id: job.JobID}}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you also update the pysqlflow, please refer to this PR in the pysqlflow PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, there is a task in the TODO list #1066 |
||
case sf.EndOfExecution: | ||
// if sqlStatements have only one field, do **NOT** return EndOfExecution message. | ||
if len(sqlStatements) > 1 { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe also need to configure the k8s API endpoint address in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point and I will add it when implementing the
Fetch
interface.