Skip to content
This repository has been archived by the owner on Apr 4, 2021. It is now read-only.

FALCON-2188 Rest api to register extension #304

Closed
wants to merge 5 commits into from

Conversation

PraveenAdlakha
Copy link
Contributor

$ bin/falcon extension -register -extensionName test -path hdfs://hostname:8020/user/dataqa/sampleextension -description "test ing"

Extension:testregistered succesfully.

Also we get file not found exception if jars or Readme is not present please look at the test cases.

Copy link

@pallavi-rao pallavi-rao left a comment

Choose a reason for hiding this comment

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

One uber question I had regarding register, unregister etc. These calls must only go to Prism (in distributed mode) and the metadata store is only present on Prism. How/where are you handling in the code to ensure this?

@@ -158,6 +167,7 @@ public Options createExtensionOptions() {
Option resume = new Option(FalconCLIConstants.RESUME_OPT, false, "Resume an extension job");
Option delete = new Option(FalconCLIConstants.DELETE_OPT, false, "Delete an extension job");
Option unregister = new Option(FalconCLIConstants.UREGISTER, false, "Delete metadata of extension job");
Option register = new Option(FalconCLIConstants.REGISTER, false, "Add metadata of extension job");

Choose a reason for hiding this comment

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

Description can be better. "Register an extension with Falcon. This will make the extension available for instantiation for all users.

checkIfExtensionServiceIsEnabled();
validateExtensionName(extensionName);
try {
return ExtensionStore.get().registerExtensionMetadata(extensionName, path, description);

Choose a reason for hiding this comment

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

Add another validation to ensure description is not empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

had a discussion with @sandeepSamudrala and decided it can be a optional field.Let me know if you think otherwise.

Choose a reason for hiding this comment

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

Fine. That is ok. Thanks for clarifying.

return file.getName().endsWith(".jar");
}
};
FileStatus[] fileStatusJar = fileSystem.listStatus(new Path(uri.getPath() + "/libs"), filter);

Choose a reason for hiding this comment

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

Believe we should check under libs/build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then we need to correct the doc too because in the doc there is no mention of libs/build or libs/runtime.

Choose a reason for hiding this comment

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

Which doc are you talking about? The design doc has it.

URI uri = new URI(path);
conf.set("fs.default.name", uri.getScheme() + "://" + uri.getAuthority());
FileSystem fileSystem = HadoopClientFactory.get().createFalconFileSystem(uri);
FileStatus[] fileStatusReadMe = fileSystem.listStatus(new Path(uri.getPath() + "/README"));

Choose a reason for hiding this comment

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

Guess it is sufficient to check for the existence of README and check if it is a file.

};
FileStatus[] fileStatusJar = fileSystem.listStatus(new Path(uri.getPath() + "/libs"), filter);

if (fileStatusReadMe.length == 1 && fileStatusJar.length >0){

Choose a reason for hiding this comment

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

Additional check for existence at least 1 file under META is required.

if (fileStatusReadMe.length == 1 && fileStatusJar.length >0){
metaStore.storeExtensionMetadataBean(extensionName, path, ExtensionType.CUSTOM, description);
}else{
throw new ValidationException("Packaging structure is not currect please refer to documentation");

Choose a reason for hiding this comment

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

Error message : Packaging structure of extension ${extensionName} is not correct. Please refer the documentation for details

Choose a reason for hiding this comment

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

Also, it is preferable to do individual checks and print the appropriate error message, rather than asking user to refer docs.

@PraveenAdlakha
Copy link
Contributor Author

@pallavi-rao ExtensionService will only be up at prism and that will take care of the requests. Please correct if I am missing some thing here.

@pallavi-rao
Copy link

@PraveenAdlakha ExtensionService may be up only for Prism. However, ExtensionManager is available for prism and falcon webapps. Hence the request will be accepted and may result in an improper error.

@PraveenAdlakha
Copy link
Contributor Author

ohhkk got it..Then we can do what we are doing with EntityManager and InstanceManager for better error handling.Will take it up as a separate jira.

return file.getName().endsWith(".jar");
}
};
FileStatus[] fileStatusJar = fileSystem.listStatus(new Path(uri.getPath() + "/libs"), filter);

Choose a reason for hiding this comment

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

Which doc are you talking about? The design doc has it.

checkIfExtensionServiceIsEnabled();
validateExtensionName(extensionName);
try {
return ExtensionStore.get().registerExtensionMetadata(extensionName, path, description);

Choose a reason for hiding this comment

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

Fine. That is ok. Thanks for clarifying.


@BeforeMethod
public void clean() {
clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

clean up the file system too

@pallavi-rao
Copy link

Will merge this. There is a test case that this PR breaks. I will address that with a separate PR as @PraveenAdlakha is out on vacation.

@asfgit asfgit closed this in fd384a7 Nov 22, 2016
pallavi-rao pushed a commit to pallavi-rao/falcon that referenced this pull request Feb 16, 2018
$ bin/falcon extension -register -extensionName test -path hdfs://hostname:8020/user/dataqa/sampleextension -description "test ing"

Extension:testregistered succesfully.

Also we get file not found exception if jars or Readme is not present please look at the test cases.

Author: Praveen Adlakha <adlakha.praveen@gmail.com>

Reviewers: @sandeepSamudrala, @pallavi-rao

Closes apache#304 from PraveenAdlakha/2188 and squashes the following commits:

e4c21a0 [Praveen Adlakha] test case disabled
90e6ec9 [Praveen Adlakha] minor comments addressed
52f6ebc [Praveen Adlakha] comments addressed
05c9c5e [Praveen Adlakha] comments addressed and test cases updated
9a74a2c [Praveen Adlakha] FALCON-2188 Rest api to register extension
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants