Skip to content
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

feat: add optimus replay list #25

Merged
merged 7 commits into from
Sep 6, 2021
Merged

feat: add optimus replay list #25

merged 7 commits into from
Sep 6, 2021

Conversation

arinda-arif
Copy link
Contributor

Add Optimus get replay list rpc & message models.

@arinda-arif arinda-arif requested a review from kushsharma August 23, 2021 04:28
@@ -194,6 +194,11 @@ service RuntimeService {
get: "/v1/project/{project_name}/job/{job_name}/replay/{id}"
};
}
rpc GetReplayList(GetReplayListRequest) returns (GetReplayListResponse) {
option (google.api.http) = {
get: "/v1/project/{project_name}/replay/list"
Copy link
Member

Choose a reason for hiding this comment

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

we should make it follow REST principles, do we need list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to not use list

@@ -194,6 +194,11 @@ service RuntimeService {
get: "/v1/project/{project_name}/job/{job_name}/replay/{id}"
};
}
rpc GetReplayList(GetReplayListRequest) returns (GetReplayListResponse) {
Copy link
Member

Choose a reason for hiding this comment

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

What if we call ListReplays

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ReplayList sounds better to me, but you have concern on this? And should we change the GetReplayStatus too?

Copy link
Member

Choose a reason for hiding this comment

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

are we considering replay as a resource? In that case, I guess it should be replays in endpoint and ListReplays in the method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

replays seems more descriptive. but i'm seeing other endpoints are not in a plural word, for example when getting projects or resource specs. thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

understood why ListReplays is better, just went through the method naming convention.

Copy link
Contributor Author

@arinda-arif arinda-arif Aug 25, 2021

Choose a reason for hiding this comment

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

seems Optimus is using singular in all the endpoint, do you think it is acceptable to keep as it is @ravisuhag ? if not, we need to apply the changes to the others as well to keep it in uniform. cc @kushsharma

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Planning to resolve this and thinking to just follow the current Optimus convention to use singular, and if a change in convention is needed, will handle it in a different issue. Please let me know if you have any concern on this, @ravisuhag

string id = 1;
string job_name = 2;
string start_date = 3;
Copy link
Member

Choose a reason for hiding this comment

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

why not google.protobuf.Timestamp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm fine either way, but since start and end date is a date, i figured the response we are sending is already represented as expected, not in protobuf timestamp. any concern on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

discussed this and decided to use timestamp

@@ -179,24 +179,24 @@ service RuntimeService {
}
rpc ReplayDryRun(ReplayRequest) returns (ReplayDryRunResponse) {
option (google.api.http) = {
post: "/v1/project/{project_name}/job/{job_name}/replay-dry-run"
post: "/v1/project/{project_name}/replay/{job_name}/dryrun"
Copy link
Member

@ravisuhag ravisuhag Aug 24, 2021

Choose a reason for hiding this comment

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

sinc dryrun is custom method. it can go as :dryrun or maybe just :dry ?
https://cloud.google.com/apis/design/custom_methods

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense. let me change it to :dryrun and test it

Copy link
Member

Choose a reason for hiding this comment

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

@ravisuhag using colon for identifying a custom verb is one way of doing it, other way is to split these custom verbs via slash. The advantage we have here when not using :verb is it avoid conflicts with the resource name. For example

/v1/project/{project_name}/replay/{job_name}/dryrun
/v1/project/{project_name}/replay/{job_name}:dryrun

Also I wonder how will the gateway regex be able to differentiate that when a URL looks like

/v1/project/test-project/replay/test-job:dryrun

job_name is test-job:dryrun or test-job? So these colon based verbs are nice when we have a fixed endpoint for example like

/v1/project/{project_name}/replay:dryrun

and have everything in the POST payload but then we won't be able to do GET calls nicely.

Its very rare we will be going to allow a job name that contains a / whereas a job name can contain : now or in the future. These colon based verbs can be used if we split them after a slash though like

/v1/project/{project_name}/replay/{job_name}/:dryrun

But then this looks like more of a choice of convention. For example github follows without colon custom verbs. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Ok cool. fine with slash as well.

@arinda-arif arinda-arif merged commit 85e464a into main Sep 6, 2021
@arinda-arif arinda-arif deleted the replay-list branch September 6, 2021 01:14
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.

3 participants