unicesi / amelia

:airplane: DSL for deploying distributed systems, with custom commands to compile and execute FraSCAti applications
GNU Lesser General Public License v3.0
2 stars 3 forks source link

Deploy a component in a subsystem and then shutdown from another #10

Closed jachinte closed 8 years ago

jachinte commented 8 years ago

From pascani/issues/9

One question, the last version of Amelia allows to deploy a component in a subsystem but shutdown from another?? @juan3036

jachinte commented 8 years ago

@juan3036 the latest version of the library allows you to stop components in three different ways, however I'm afraid none of them is exactly what you expect. Here is an example:

Let A, B and C be subsystems. A depends on B, and B depends on C. Given these dependencies, you would follow one of the following strategies, or all combined:

  1. Execute components in A, B and/or C, and when deployment is finished stop them all or do nothing and let them running (when components have been executed in server mode).
  2. Execute components in A, then in B and then stop ALL components in A (and optionally in B), and then execute components in C.
  3. Execute components in A and B, then i) stop them ALL from C or ii) execute components in C and then stop ALL components in A, B and C in whatever order you want (always grouped by subsystem).

Which one fits your needs?


When I say none of them is exactly what you expect is because I understand you want to target specific components and shut them down. In the current implementation this is not possible, however with a little effort it could be implemented. Maybe this will be available in the future.

juan3036 commented 8 years ago

I'm glad to hear you again @jachinte ! Well, it is as you say in the last paragraph "you want to target specific components and shut them down". The options that you mentioned could be useful but they not fit my current needs. I was asking you this, in order to avoid the error presented in Pascani. Since the error in the fetch method is raised because some components are still reporting events while a fetch is tryed. So if I could deploy my subsystem and when process is finished shutdown all components except the External Probe, I could run another subsystem that deploys my reporter component. So at this point as there are no more components reporting new events the reporter should not crash when the fetch method is called. I found a partial solution, however this does not solve the error anyway. I decided to run the fetch method only once, instead of the multiple calls I had it before. With that change I could run a proof-of-concept test during 24 hours successfully.

Regards

jachinte commented 8 years ago

I understand. This change could actually benefit a lot the library, so let me evaluate if this can be done. You know there are other affairs right now :smile:

jachinte commented 8 years ago

@juan3036 I'm working on this :+1:

jachinte commented 8 years ago

Hi @juan3036, It's complete now! It may need a little bit of testing, and the API may change but the functionality will remain. You can now reach specific components when shutting down dependencies. This means that you can shutdown dependencies but stop only certain composites; how does that sound?

To shutdown a dependency and stop a specific component (you can also stop several) you would use:

dependency.deployment().shutdownAndStopComponents("compositeName");

where dependency is a Subsystem from the list of dependencies in the method signature public void deploy(String subsystem, List<Subsystem> dependencies).... To identify each dependency, use the alias attribute (the parameter you use to initialize subsystems).

I hope it helps!


For a complete list of the methods you can explore the class org.amelia.dsl.lib.Subsystem$Deployment.

juan3036 commented 8 years ago

Hi @jachinte

It sounds great, I expect to test this new function soon. I will be telling you my comments.