Skip to content

Conversation

@shendiaomo
Copy link
Collaborator

Partially fix #1558
A pitfall is that it takes longer for repl/sqlflowserver to start-up because we have to import tensorflow


// ExtractDocString extracts parameter documents from python doc strings
func ExtractDocString(module ...string) {
cmd := exec.Command("python", "-uc", fmt.Sprintf("__import__('extract_docstring').print_param_doc('%s')", strings.Join(module, "', '")))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make a local call here to print the docstring, other than start a process?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's somewhat hard to implement because we have to import the classes to get the docstrings. I have investigated several python bindings of golang but they are either too primitive (go-python) or not as reliable.

if e != nil {
log.Println("ExtractDocString failed: ", e, string(output))
}
if e := json.Unmarshal(output, &PremadeModelParamsDocs); e != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment that unmarshal can append entries rather than overwrite it: https://golang.org/pkg/encoding/json/#Unmarshal

@shendiaomo shendiaomo merged commit 11f28f3 into sql-machine-learning:develop Jan 16, 2020
@shendiaomo shendiaomo deleted the sf_models_param_doc branch January 16, 2020 04:07
export PYTHONPATH=$GOPATH/src/sqlflow.org/sqlflow/python

sqlflowserver &
sleep 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to change this sleep to a while loop that pings the SQLFlow server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract docstrings to model parameters dynamically

4 participants