Spring for Apache Hadoop
  1. Spring for Apache Hadoop
  2. SHDP-34

Support property replacement of Spring Batch Job Parameters in Script Tasklet and all Job Types

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 1.0.0.M2
    • Component/s: FS, MR
    • Labels:
      None

      Description

      Would like to be able to support
      <script-tasklet id="script-tasklet">
      <script language="groovy">

      .....
      fsh.copyFromLocal("#

      {jobParameters['input.file']}", inputPath);
      </script>
      </script-tasklet>


      The #{jobParameters['input.file']}

      uses SpEL to evaluate the expression and Batch populated the SpEL context with the jobParameters map. See http://static.springsource.org/spring-batch/reference/html/configureStep.html#late-binding

      tried some quick solutions but didn't dive into the details. this is what is known so far.

      Setting only the ScriptTaskletParser to be of scope=step failed with

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.hadoop.scripting.HdfsScriptFactoryBean#0': Cannot create inner bean '(inner bean)' of type [org.springframework.scripting.support.StaticScriptSource] while setting bean property 'scriptSource'; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext

      and setting ScriptParser to scope=step in addition gives a more unusual error

      Caused by: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'input' of bean class [org.springframework.batch.core.scope.context.StepContext]: Bean property 'input' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
      at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:141)

        Activity

        Mark Pollack created issue -
        Mark Pollack made changes -
        Field Original Value New Value
        Fix Version/s 1.0.0.M1 [ 12751 ]
        Fix Version/s 1.0.0.M2 [ 12814 ]
        Mark Pollack made changes -
        Summary Support property replacement of Spring Batch Job Parameters in Script Tasklet Support property replacement of Spring Batch Job Parameters in Script Tasklet and all Job Types
        Component/s MR [ 11700 ]
        Costin Leau made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Complete [ 8 ]
        Trevor Marshall made changes -
        Workflow jira [ 52211 ] SHDP Workflow [ 99171 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        61d 23h 4m 1 Costin Leau 19/Apr/12 8:51 AM

          People

          • Assignee:
            Costin Leau
            Reporter:
            Mark Pollack
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: