thanks a lot Alex.

I saw my jar from the java process. But cannot see the logs I print out from
the ignite console, I am not sure whether the task run or not run, 

My META-INF/ignite.xml defined as below,

<?xml version="1.0" encoding="UTF-8"?>



<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:util="http://www.springframework.org/schema/util";
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd";>
    <description>Ignite Spring configuration file in gar-file.</description>

    
    <util:list id="tasks">
        <value>com.coinflex.ComputeTaskDeployment</value>
   </util:list>
</beans>

And the task ComputeTaskDeployment is simple as below,

public class ComputeTaskDeployment extends ComputeTaskSplitAdapter<String,
Integer> {

        @IgniteInstanceResource
        Ignite ignite;

        public ComputeTaskDeployment() {
            System.out.println("starting the ComputeTaskDeployment sample");
        }



        @Override
        protected Collection<? extends ComputeJob> split(int clusterSize,
String arg) {
            Collection<ComputeJob> jobs = new LinkedList<>();

            arg = "how many words there.";


            for (final String word : arg.split(" ")) {
                jobs.add(new ComputeJobAdapter() {
                    @Nullable @Override public Object execute() {

                        // Return number of letters in the word.
                        int len = word.length();
                        System.out.println(">>> Printing '" + word + "'
length is:" + len + " on this nodeID "
                                + ignite.cluster().localNode().id() + " from
ignite job.");
                        return len;

                    }

                });
            }

            return jobs;
        }


        /** {@inheritDoc} */
        @Nullable
        @Override
        public Integer reduce(List<ComputeJobResult> results) {
            int sum = 0;
            System.out.println("reduce start...");
            for (ComputeJobResult res : results)
                sum += res.<Integer>getData();

            return sum;
        }
    }


thanks again Alex




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to