Skip to main content
MahmoudSaeed
Gold ⭐️
February 19, 2024
Solved

ExecuteGroovyScript Script File duplicated Script File and failure strategy property while the deployment

Dear there, 

While i make the Nifi deployment to build ExecuteGroovyScript like that 

from integration_pipeline.models.processors.script_processors.script_processor_base import ScriptProcessorBase


class ExecuteGroovyScriptProcessor(ScriptProcessorBase):

    @property
    def name(self) -> str:
        return 'org.apache.nifi.processors.groovyx.ExecuteGroovyScript'

    def insert_custom_properties(self, script_file: str,
                                 module_directory: str = None, **kwargs):
        self.set_configuration_properties({**{"Script File": script_file,
                                              "Module Directory": module_directory,
                                              "Failure strategy":"transfer to failure"},
                                           **kwargs,

                                           **self._processor_configuration["properties"]})
 
 
 
then i used it in my pipeline model to build the pipeline while deployment 
create_update_script = ExecuteGroovyScriptProcessor(auto_terminated_relationships=["success"],
                                                      processor_location_x=900,
                                                      processor_location_y=600)

        create_update_script.insert_custom_properties(
                                                      script_file=create_update_script_path,
                                                      module_directory=module_directory,
                                                      graphql_endpoint=graphql_endpoint,
                                                      graphql_update_query=update_query,
                                                      graphql_create_query=create_query,
                                                      graphql_search_query=search_query,
                                                      user_profile=user_profile,
                                                      # the create query for the DF Group
                                                      create_group_query=create_group_query,
                                                      # the search query for the DF Group
                                                      search_group_query=search_group_query)
 
it appear in nifi ui that it make a new property called Script File with the path that i passed to it but it should put it in the property that is define by the groovyscript , i don;t know why it duplicated the property name and don't pass the path to the Script File that is defined by the script , here is the result that i get in nifi ui . also the same thing appear in failure strategy
Screenshot (37).png

 

MahmoudSaeed
Gold ⭐️
February 20, 2024

I know the solution , 

I should write it like that 

convert Script File to groovyx-script-file

class ExecuteGroovyScriptProcessor(ScriptProcessorBase):

 

    @property
    def name(self) -> str:
        return 'org.apache.nifi.processors.groovyx.ExecuteGroovyScript'

 

    def insert_custom_properties(self, script_file: str,
                                 module_directory: str = None, **kwargs):
        self.set_configuration_properties({**{"groovyx-script-file": script_file,
                                              "Module Directory": module_directory,
                                              "groovyx-failure-strategy":"transfer to failure"},
                                           **kwargs,

 

                                           **self._processor_configuration["properties"]})

3 replies

VidyaSargur
Community Manager
Community Manager
February 20, 2024

@MahmoudSaeed, Welcome to our community! To help you get the best possible answer, I have tagged our NiFi experts @steven-matison @TimothySpann @SAMSAL who may be able to assist you further.

Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.

Translate
Regards, Vidya Sargur, Community Manager Was your question answered? Make sure to mark the answer as the accepted solution. If you find a reply useful, say thanks by clicking on the thumbs up button.
MahmoudSaeed
Gold ⭐️
February 20, 2024

Dear Vidya Sargur,

thanks for your efforts

Translate
MahmoudSaeed
MahmoudSaeedAuthorAnswer
Gold ⭐️
February 20, 2024

I know the solution , 

I should write it like that 

convert Script File to groovyx-script-file

class ExecuteGroovyScriptProcessor(ScriptProcessorBase):

 

    @property
    def name(self) -> str:
        return 'org.apache.nifi.processors.groovyx.ExecuteGroovyScript'

 

    def insert_custom_properties(self, script_file: str,
                                 module_directory: str = None, **kwargs):
        self.set_configuration_properties({**{"groovyx-script-file": script_file,
                                              "Module Directory": module_directory,
                                              "groovyx-failure-strategy":"transfer to failure"},
                                           **kwargs,

 

                                           **self._processor_configuration["properties"]})
Translate