Skip to content

Conversation

@smacker
Copy link
Contributor

@smacker smacker commented Jan 29, 2019

Currently, we call feature-extractor 3 times per file in file mode and
number of functions * number of files * 3 in function mode.

Each time we send full uast to feature-extractor server.

This commit introduces new Extract method that can run different
extractors sequentially on UAST and return features from all of them.

I kept all previous methods both in server and client but changed
request parameters so Extract and old method could share extractors
configuration.

@smacker
Copy link
Contributor Author

smacker commented Jan 29, 2019

Please let me know if you think I should drop per-extractor methods. It would simplify the code.

if request.HasField(name):
options = getattr(request, name, None)
constructor = getattr(self, "_%s_extractor" % name)
extractors.append(constructor(options))

Choose a reason for hiding this comment

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

The constructor functions do not check for options to be None.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as far as I understand generated grpc code it can't be None if request.HasField returns true. But I added just check just in case something changes. Thanks!

Choose a reason for hiding this comment

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

Oh ok, didn't know that! But yup, better be sure by still adding the check 👍

}

message GraphletOptions {
int32 docfreqThreshold = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it's ok to skip 1 and keep the same order as when this was in GraphletRequest, but is there a reason to do it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, no reason. I missed it because to copy-past. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Currently, we call feature-extractor 3 times per file in file mode and
number of functions * number of files * 3 in function mode.

Each time we send full uast to feature-extractor server.

This commit introduces new Extract method that can run different
extractors sequentially on UAST and return features from all of them.

I kept all previous methods both in server and client but changed
request parameters so Extract and old method could share extractors
configuration.

Signed-off-by: Maxim Sukharev <[email protected]>
@smacker
Copy link
Contributor Author

smacker commented Feb 5, 2019

Sorry for push-force but changes required code regeneration and it became a mess anyway.

Fixes applied. I'll merge after CI is green then.

@smacker smacker merged commit 84106dd into src-d:master Feb 5, 2019
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