Issues at Run

24 views
Skip to first unread message

Belkeziz Radia

unread,
Mar 6, 2019, 3:47:46 AM3/6/19
to sarl
Hello, I am a beginner in SARL. I am trying to open a file from my program. My issue is at the Run level. I can not usecommand-line tools. Whenever I try to open them, it blocks and they close immediately. Also when I try to run my agent directly from the IDE, on the console it blocks on "launching agent" and nothing happens. I really don't know where the problem is..

Stéphane Galland

unread,
Mar 6, 2019, 4:53:14 AM3/6/19
to sarl
Hello.
We need more information to give you a concrete answer, because the causes why the system is doing nothing are multiple.
I recommend you to provide a piece of code, and the description of the method you have used for launching.

Belkeziz Radia

unread,
Mar 6, 2019, 5:31:40 AM3/6/19
to sarl
In my program, I implemented an agent that uses a capacity which defines a function to open a file. The code is :

event MyEvent

capacity MyCapacity {
def open(filename : String) : String
}

skill MySkill implements MyCapacity {
def open(filename : String) : String {
var ips : InputStream = new FileInputStream(filename)
var ipsr : InputStreamReader = new InputStreamReader(ips)
var br : BufferedReader = new BufferedReader(ipsr)
var line : String = br.readLine()
return "open"
}
}

agent MyAgent {
uses MyCapacity

on Initialize {

var s = new MySkill

setSkill(s)
}

on MyEvent {

open ("C:\\Users\\Lenovo\\Desktop\\GolfCountryClub")
}
}


I run the program from the IDE. In the console I get :

[INFOS, 11:28:21am, Janus SRE] Context 2c38fb7f-f363-4f6e-877b-110b1f07cc77 created
[INFOS, 11:28:21am, Janus SRE] Space SpaceID [
  type = "SpaceID"
  id = 7ba8885d-545b-445a-a0e9-b655bc15ebe0
  contextID = 2c38fb7f-f363-4f6e-877b-110b1f07cc77
  spaceSpec = interface io.sarl.util.OpenEventSpaceSpecification
] is created
[INFOS, 11:28:21am, Janus SRE] Launching the agent: MyAgent


Le mercredi 6 mars 2019 09:47:46 UTC+1, Belkeziz Radia a écrit :

Stéphane Galland

unread,
Mar 6, 2019, 6:27:40 AM3/6/19
to sa...@googlegroups.com
The agent that you have defined does nothing except when it receives an event of type `MyEvent`.
No instance of this event is created and fired within your code.
Consequently, the agent waits without doing anything. And your system looks like frozen.

You could update your code as:

uses Behaviors

on
Initialize {

                var s = new MySkill

                setSkill(s)

               wake
(new MyEvent)
    }


The `ẁake` function (provided by `Behaviors`) fires the given event into the agent, i.e. the event is never fired outside the agent.

Belkeziz Radia

unread,
Mar 6, 2019, 10:51:26 AM3/6/19
to sarl
Thank you for your reply and for your time ! 


Le mercredi 6 mars 2019 09:47:46 UTC+1, Belkeziz Radia a écrit :

Belkeziz Radia

unread,
Dec 4, 2019, 10:57:41 AM12/4/19
to sarl
Hello,
I would like to know if there is a way to consume a REST service and if so how does it work ?

Thank you. 

--
You received this message because you are subscribed to the Google Groups "sarl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sarl+uns...@googlegroups.com.
To post to this group, send email to sa...@googlegroups.com.
Visit this group at https://groups.google.com/group/sarl.
To view this discussion on the web visit https://groups.google.com/d/msgid/sarl/6398c5be-4204-4c22-abb4-046c6651f013%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stéphane Galland

unread,
Dec 5, 2019, 6:04:27 AM12/5/19
to sarl
Hello.

There is absolutely no problem to have access to a REST service from a multiagent system written with SARL.
Indeed, the SARL code is translated to Java code. There is any way

The question is how to include REST service in the case of your model.
There is different ways (from the most simple to the most complex) :
1) Create a capacity and a skill to enable the agent to have access to the REST service.
2) Create a space and the related capacities and skills that exhibit the REST service. It is close to an implementation of an artifact that is dedicated to the REST service.
3) Create an agent that has access to the REST service and set up an interaction protocol between this agent and the other agents.

We need to have more details from you in order to give you a more precise answer.

All the best.

Le mercredi 4 décembre 2019 16:57:41 UTC+1, Belkeziz Radia a écrit :
Hello,
I would like to know if there is a way to consume a REST service and if so how does it work ?

Thank you. 

Le mer. 6 mar. 2019 à 16:51, Belkeziz Radia <belkezi...@gmail.com> a écrit :
Thank you for your reply and for your time ! 

Le mercredi 6 mars 2019 09:47:46 UTC+1, Belkeziz Radia a écrit :
Hello, I am a beginner in SARL. I am trying to open a file from my program. My issue is at the Run level. I can not usecommand-line tools. Whenever I try to open them, it blocks and they close immediately. Also when I try to run my agent directly from the IDE, on the console it blocks on "launching agent" and nothing happens. I really don't know where the problem is..

--
You received this message because you are subscribed to the Google Groups "sarl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sarl+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages