Announcement Announcement Module
Collapse
No announcement yet.
Running spring jobs remotely (on grid) - serialization issues Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Running spring jobs remotely (on grid) - serialization issues

    Hello,
    I'm new to spring batch. I am trying to use ProActive Scheduling in order to execute a Spring batch job on a cluster managed by ProActive.
    In order to do so I took a look at org.springframework.batch.core.partition (I run the job defined in {spring_batch_home}/src/test/resources/org/springframework/batch/core/partition/launch-context.xml and it is working just fin in multi-thread)

    Now I want to modify the org.springframework.batch.core.partition.support.T askExecutorPartitionHandler#handle method in order to execute the stepExecutions remotely, on my grid. In order to do so I need to create some executable objects (one per StepExecution) and send them remotely to the "slaves".
    So the code executed on the remote "slave" would contain sometging like
    step.execute(stepExecution);


    The problem is that the TaskletStep (the implementation provided for the Step interface) is not serializable so I cannot wrap it into an object in order to serialize it and send it over the network. (on the other hand the StepExecution object is serializable).

    Therefore I need a serializable implementatoin of Step in order to implement the usecase described in the documentation :
    http://static.springframework.org/sp...ioning-spi.png


    Could anyone tell me if my approach is correct (am I not seeing something) or if there is a serializable implementation of Step that I did not find.
    Or am I just on the wrong direction?


    Thank you,
    Emil Salageanu

  • #2
    A Step is a configuration artifact - a recipe for how to run some application logic. It is a stateless service, like most Spring components, and isn't supposed to be serialized, since it has dependencies which are themselves Spring components. You'd end up serializing the whole ApplicationContext, which is pointless because Spring knows how to load it from a config file. So your strategy should be to send the step name and step execution (or just the step execution id) to the remote process, and make sure it can locate the Step instance from a locally constructed context.

    Comment


    • #3
      Thanks

      Thank you for your reply Dave,

      I will try to do so and I'll post my results on this topic.

      Emil.

      Comment


      • #4
        help needed for the Remote ApplicationContext

        Hello again,

        THE CONTEXT:

        I managed to write a PartitionHandler which uses the ProActive Scheduling API in order to execute the steps on an infrastructure managed by ProActive, and averything it's working just fine. I'll comme back with details once it is finished.

        In this first implementation I just copy, by hand, the xml configuration files (launch-context.xml and data-source.xml) to the remote nodes.

        THE PROBLEM

        No I would like to obtain, on the remote nodes, the Application context automatically, so I can provide to the ProActive users a complete solution: one should be able to distribute on a proactive grid only by configuring and using the Proactive Partition Handler bean.

        I see 2 possible solutions:
        1. automatically push the xml files to the nodes (in this case, is there a Spring implementation taht solves the dependenvies between the different xml files)?
        2. just send to the remote nodes some parameters from which the application context can be created remotely. Any idea how to do this?


        Thank you,

        Emil Salageanu,
        Proactive developer,
        www.activeeon.com

        Comment

        Working...
        X