You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@s2graph.apache.org by "Daewon Jeong (JIRA)" <ji...@apache.org> on 2018/09/19 07:06:00 UTC

***UNCHECKED*** [jira] [Commented] (S2GRAPH-240) Add management api for Experiment and Bucket.

    [ https://issues.apache.org/jira/browse/S2GRAPH-240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620206#comment-16620206 ] 

Daewon Jeong commented on S2GRAPH-240:
--------------------------------------

GraphQL officially supports parameter substitution in Query.
It also supports queries stored on the server under the name `Persisted Queries`.

It seems that we can implement the proposed function through the above two combinations.

example) Including queries in requests and using Persisted Queries.

Variable substitution
{code}
{
  "query": "query GetUser($id: ID!) { getUser(id: $id) { id username } }",
  "variables": { "id": 7 }
}
{code}

Persisted Queries
{code}
{
  "id": 1,
  "variables": { "id": 7 }
}
{code}


link: https://docs.scaphold.io/tutorials/persisted-queries/

> Add management api for Experiment and Bucket.
> ---------------------------------------------
>
>                 Key: S2GRAPH-240
>                 URL: https://issues.apache.org/jira/browse/S2GRAPH-240
>             Project: S2Graph
>          Issue Type: Improvement
>          Components: s2core
>            Reporter: DOYUNG YOON
>            Priority: Major
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
> h1. Background
> Experiment and Bucket exist to support A/B bucket test.
> Here is how they can be used for bucket test.
> 1. Experiment: Experiment represents a single API endpoint for experimenting multiple buckets. 
> 2. Create Bucket: Bucket contains single s2graph query template in JSON. it can be thought of as the stored procedure. 
> A single experiment can have one to many buckets. 
> Without specifying the bucket name, experiment follows traffic ratio to select which bucket to select the given user's POST request, which contains variables need to be interpolated into stored query template in the selected bucket.
> h2. Example.
> Here is one example configuration for a single experiment.
> {noformat}
> Experiment 1:
> 	Bucket A(1~99): 99% of requests will be lead to this bucket.
> 	Bucket B(99~100): 1% of requests will be lead to this bucket.
> {noformat}
> Bucket A: following is example of s2graph query to recommend moivies for the user.
> {noformat}
> {
>   "select": [
>     "movie_id"
>   ],
>   "srcVertices": [
>     {
>       "serviceName": "s2graph",
>       "columnName": "user_id",
>       "id": "[[USER_ID]]"
>     }
>   ],
>   "steps": [
>   	{
>   		"step": [
> 	      {
> 	        "label": "user_watched_movies",
> 	        "limit": 10
> 	      }
> 	    ]
>   	}, 
>     {
>     	"step": [
>     		{
> 	        "label": "similar_movie_model_x",
> 	        "limit": 10
> 	      }
>     	]
>     }
>   ]
> }
> {noformat}
> Note that to test two logic, similar_movie_model_x and similar_movie_model_y, we need to create two buckets, each per model. 
> Also, the changing part of this query is only `[[USER_ID]]`, so register template as a bucket and client send only changing variables.
> {noformat}
> curl -XPOST -H 'Content-Type:application/json' localhost:9000/graphs/experiment/access_token_for_this_experiment/experiment_name/id -d '
> {
> 	"[[USER_ID]]": "steamshon"
> }
> '
> {noformat}
> Given user request, Experiment builds complete s2graph query mixing payload and registered template which yield "similar movies to user watched".
> This experiment includes `S2-Impression-Id`(bucket name) which indicate the bucket name that built result. Once the user makes the conversion, the client send feedback edge as follow.
> {noformat}
> {
> 	"timestamp": "now",
> 	"from": "user_id", 
> 	"to": "S2-Impression-Id value",
> 	"label": "movie_recommend_feedback",
> 	"props": {
> 		"conversion_type": "imp/click/etc"
> 	}
> }
> {noformat}
> Once this data is available, we can decide which bucket is best based on real user feedback.
> h1. Suggestion
> Since it is a handy feature, there is no management(CRUD) API on Bucket and Experiment. 
> It would be great if we can polish this feature more.
> 1. support GraphQL in Bucket: would be better if we can use GraphQL query in Bucket.
> 2. add management API.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)