Coder Social home page Coder Social logo

Comments (10)

s-daehling avatar s-daehling commented on July 19, 2024

The behavior you describe is actually intended.
Deleting an agent or entire MAS terminates the agents but it does not remove the data. However, the status field should show a different status code (this is not well documented yet).
The AMS does not delete the data since this might cause problems with other modules. For example, the user might still want to access log messages from agents or MASs after they have been terminated, e.g. for debugging. If the AMS would delete the data and reuse the ID, there is no way to tell which MAS actually created the logs. New logs would simply be appended to the old ones under the same MAS ID.
That is why the data is still available, the status code is changed to show that the MAS is terminated and the next MAS to be started gets a new ID. Similar considerations are true for single agents.

I would suggest the following:

  1. Improve documentation to clarify that data is not deleted when terminating agents and MAS
  2. Add documentation for status codes
  3. Add a new API endpoint to reset clonemap, i.e. really delete all data and start from ID 0 again. This would correspond to the behavior you expected.

What do you think about this?

from clonemap.

FWuellhorst avatar FWuellhorst commented on July 19, 2024

Thanks for the quick response!
That makes sense, I did not thought about the logging and debugging side.
But: Terminating/deleting one agent alone does not work. Is that intended as well?

I approve of your points, especially point 3.
One note, however: I would use different naming. Reset indicates "start the MAS/Agent with the exact same config", whereas a user maybe wants to debug an agent, update the config and then restart it. From your definition, a reset would mean "delete agent and config data", or?
Two options to get a clear naming, this way the docs don't need to be that explicit:

  1. Name the current DELETE -> TERMINATE and your mentioned RESET -> DELETE
  2. Just keep DELETE, but enable a curl DELETE mas\0\config and mas\0\agents\1\config to delete the data as well.

from clonemap.

s-daehling avatar s-daehling commented on July 19, 2024

I will look into the problem with deleting single agents. Maybe this is a problem with clonemapy not cloneMAP itself.

I can use the naming you suggest for the docu, but we have to be careful not to confuse it with the http methods, since there are no methds TERMINATE or RESET. Regarding the reset, I meant that a reset would be applied to the entire platform, not only one MAS. Reseting cloneMAP would terminate all MASs and delete all their data (in all modules), so that a user can continue as if the platform is started fresh.

I am still not sure if terminating and deleting data of a single MAS is a good idea.
For example: Lets say we have four MASs: 0, 1, 2 and 3. Now we terminated and delete MAS 1. After that we start a new MAS. Should it have ID 1 or ID 4? Either way it might be unexpected behavior to the user. Keeping the data until the platform is stopped or reset, makes the behavior more clear, I think.

I will start with the implementation of a platform reset function as described. If this is not sufficient for your usecase, we can discuss again.

from clonemap.

FWuellhorst avatar FWuellhorst commented on July 19, 2024

I agree regarding the reset.
Maybe we then need to look at the name and Id coupling with the agentlib. If I restart an agent, it's not possible as the name already exists.
Regarding clonemapy: I will look into it and create an according issue. Debugging python will be no problem.

from clonemap.

FWuellhorst avatar FWuellhorst commented on July 19, 2024

After fixing the underlying bug in clonemapy (sogno-platform/clonemapy#1), the agent stops. However, the docker container with the agency is still running.
To match my requirements (delete and re-start single agents for monitoring) and looking at the discussion, I would need only one feature:
Delete an agent (works) and stop the agency if no agents are present (feature in clonemapy?, only optional to prevent empty docker containers). Keep the data but enable posting new agents with the same name. If this is not possible due to design, deleting the existing data would be necessary.

Regarding resetting the whole MAS: This is not required from my side. This can be already achieved by composing down and up again.

from clonemap.

s-daehling avatar s-daehling commented on July 19, 2024

I have merged your fix in clonemapy into the develop branch. Thanks :)

Regarding your feature requests:

Delete an agent and stop agency:
Deleting agents should work now.
Empty agencies are currently not stopped. This is actually not easy to implement because, when deployed with k8s, cloneMAP uses StatefulSets for the agencies. The agency ID of cloneMAP then matches the ID of the container in the StatefulSet. Container IDs in k8s StatefulSets are generated from a counter. Thus the naming of the containers: e.g. mas-0-im-0-agency-0:n.mas0agencies
In a StatefulSet it is not possible to stop specific containers. We can only reduce the number of containers, i.e. scale down. If we scale down by one container, k8s will remove the container with the highest ID. After that we have the following containers: mas-0-im-0-agency-0:n-1.mas0agencies. If we have an empty agency in the middle of the StatefulSet, it is not possible to stop this specific agency container.
You are using cloneMAP with docker-compose. Here it would be possible to implement the stopping of agencies. However, I would like to keep the behavior of cloneMAP the same, independent from the deployment method. Hence, I would prefer not to implement this.
However, I addressed a bug in #5 . Now, if you delete an agent from an agency, and afterwards start a new agent, this new agent is scheduled to the existing agency. So, empty or partially-empty agencies are reused by new agents. For example, let's say we have four agents and a maximum of two agents per agency. Then agents 0 and 1 are in agency 0. And agent 2 and 3 are in agency 1. Now we delete agent 1. After that we create a new agent, which gets the ID 4. This agent will then be scheduled to agency 0. Before the fix, a new agency would have been created for the agent.
It is not yet merged into develop, but you can test it using the latest tag.

Keep the data but enable posting new agents with the same name:
This should already be possible. cloneMAP does not care about uniqueness of the agent name. I successfully tried to start several agents with the same name. If it is not possible, please let me know.

resetting the whole MAS:
Since you do not require this feature, I will not implement it yet, but keep it in mind as potential feature in the future.

from clonemap.

FWuellhorst avatar FWuellhorst commented on July 19, 2024

Keep the data but enable posting new agents with the same name: This works for me.
resetting the whole MAS: Sound good to me.
Delete an agent and stop agency: The solution in #5 seems to be more than sufficient. My only goal is to be able to delete and restart agents without spawning inf agencies.

from clonemap.

s-daehling avatar s-daehling commented on July 19, 2024

I just merged #6 and closed #5

@FWuellhorst Can I close this issue?

from clonemap.

FWuellhorst avatar FWuellhorst commented on July 19, 2024

Yes, thanks for the quick fix!

from clonemap.

FWuellhorst avatar FWuellhorst commented on July 19, 2024

@s-daehling @kwe712
Coming to this issue one more time for a follow up question:
If it is not possible to delete an MAS, can I at least check if the MAS is alive? I did not find a specific endpoint in the open_api.yml. Is this even possible?

from clonemap.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.