Package pku.cbi.abcgrid.master

Examples of pku.cbi.abcgrid.master.Task


     * on Master's task queue. A broken connection may leads to RemoteException. 
     * */
    public static Task getTask(String service)
            throws RemoteException
    {
        Task task;
        while (true)
        {
            try
            {
                Status.set("idle");
View Full Code Here


        //    logger.debug("TaskRunnerThread started");
        while (true)
        {
            try
            {
                Task task = queue.take();
                //Future<Result> f = executor.submit(new TaskRunner(task));
                //Status.set("process task: "+service);
                String msg = String.format("[%d,%d], %s",
                        task.getJobId(),
                        task.getTaskId(),
                        Util.join(task.getCommand(), " "));
                if (Config.isVerbose())
                {
                    logger.info(msg);
                }
                Status.set("execute: " + msg);
View Full Code Here

    {
        AtomicLong task_id = new AtomicLong(1L);
        String user_dir = config.getUserDir(job.getSubmitter());
        List<Task> tasks = new ArrayList<Task>();
        //String[] taskcmd = removePathOfInputFile(job);
        Task t = new Task(
                job.getId(),
                task_id.getAndIncrement(),
                job.getServiceName(),
                job.getCommand(),
                job.getPriority(),
                0);
        Fragmentable frag = new PDB();
        for (TaskInput input : job.getInput())
        {
            File f = new File(user_dir, input.getName());
            int num_workers = WorkerManager.getInstance().getWorkerNum();
            num_workers = num_workers > 0 ? num_workers : 10;
            Object[] data = frag.fragment(f, num_workers);
            t.addInput(new TaskInput(input.getName(), data[0].toString().getBytes()));
        }
        tasks.add(t);
        return tasks;
    }
View Full Code Here

                num_workers = num_workers > 0 ? num_workers : 10;
                data = frag.fragment(new ByteArrayInputStream(input_data), num_workers);
                List<Task> tasks = new ArrayList<Task>(data.length);
                for (Object d : data)
                {
                    Task t = new Task(
                            job.getId(),
                            task_id.getAndIncrement(),
                            job.getServiceName(),
                            job.getCommand(),
                            job.getPriority(),
                            0);
                    t.addInput(new TaskInput(input_filename, d.toString().getBytes()));
                    tasks.add(t);
                }
                return tasks;
            }
            else//Task could have no any data. e.g. just use -h to print help message.
            {
                List<Task> tasks = new ArrayList<Task>(1);
                Task t = new Task(
                        job.getId(),
                        task_id.getAndIncrement(),
                        job.getServiceName(),
                        job.getCommand(),
                        job.getPriority(),
View Full Code Here

        public List<Task> call() throws Exception
        {
            AtomicLong task_id = new AtomicLong(1L);
            String user_dir = config.getUserDir(job.getSubmitter());
            List<Task> tasks = new ArrayList<Task>(1);
            Task t = new Task(
                    job.getId(),
                    task_id.getAndIncrement(),
                    job.getServiceName(),
                    job.getCommand(),
                    job.getPriority(),
                    0);
            for (TaskInput entry : job.getInput())
            {
                String fname = entry.getName();
                byte[] fdata = entry.getData();
                Fragmentable frag = FormatDetector.getFragmenter(new File(user_dir, fname));
                if (frag == null)
                    throw new Exception("Failed to  detect the format of input file:" + fname);
                Object[] data;
                int num_workers = WorkerManager.getInstance().getWorkerNum();
                num_workers = num_workers > 0 ? num_workers : 10;
                data = frag.fragment(new ByteArrayInputStream(fdata), num_workers);
                t.addInput(new TaskInput(fname, data[0].toString().getBytes()));
            }
            tasks.add(t);
            return tasks;
        }
View Full Code Here

    {
        try
        {
            while (!Thread.currentThread().isInterrupted())
            {
                Task t = MasterProxy.getTask(service);
                if (t != null)
                {
                    queue.put(t);
                }
            }
View Full Code Here

    {
        AtomicLong task_id = new AtomicLong(1L);
        String user_dir = config.getUserDir(job.getSubmitter());
        List<Task> tasks = new ArrayList<Task>();
        //String[] taskcmd = removePathOfInputFile(job);
        Task t = new Task(
                job.getId(),
                task_id.getAndIncrement(),
                job.getServiceName(),
                job.getCommand(),
                job.getPriority(),
                0);
        Fragmentable frag = new PDB();
        for (TaskInput input : job.getInput())
        {
            File f = new File(user_dir, input.getName());
            int num_workers = WorkerManager.getInstance().getWorkerNum();
            num_workers = num_workers > 0 ? num_workers : 10;
            Object[] data = frag.fragment(f, num_workers);
            t.addInput(new TaskInput(input.getName(), data[0].toString().getBytes()));
        }
        tasks.add(t);
        return tasks;
    }
View Full Code Here

TOP

Related Classes of pku.cbi.abcgrid.master.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.