2 * Copyright 2006-2012. The SimGrid Team. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package.
10 import org.simgrid.msg.Host
11 import org.simgrid.msg.HostFailureException
12 import org.simgrid.msg.Msg
13 import org.simgrid.msg.Task
14 import org.simgrid.msg.TaskCancelledException
15 import org.simgrid.msg.TimeoutException
16 import org.simgrid.msg.TransferFailureException
17 import org.simgrid.msg.Process
19 class Slave(host:Host, name:String, args:Array[String]) extends Process(host,name,args) {
20 def main(args:Array[String]){
21 if (args.length < 1) {
22 Msg.info("Slave needs 1 argument (its number)")
26 val num = args(0).toInt
28 continually({Task.receive("slave_"+num)})
29 .takeWhile(!_.isInstanceOf[FinalizeTask])
31 Msg.info("Received \"" + task.getName() + "\". Processing it.");
35 case e:TaskCancelledException => {}
39 Msg.info("Received Finalize. I'm done. See you!")