-
Notifications
You must be signed in to change notification settings - Fork 1
how_to_define_sr_configuration
Aritz Brosa edited this page Mar 25, 2024
·
9 revisions
- From user's standpoint, when defining the FaaS flavour to be used for the SR that is going to be deployed within COGNIT, the user can do that as it's shown in this example code:
# Configure the Serverless Runtime requeriments
sr_conf = ServerlessRuntimeConfig()
sr_conf.name = "Example Serverless Runtime"
sr_conf.scheduling_policies = [EnergySchedulingPolicy(40)]
sr_conf.faas_flavour = "Energy"
Being,
- sr_conf.name, the one given to the SR that's going to be deployed.
- sr_conf.scheduling_policies, a list of policies that can apply to the deployment of the SR about to be deployed, which can be set as specified in the example by default.
- sr_conf.faas_flavour, the FLAVOUR that user wants to use for its deployment (The available Flavours can be checked in Templates -> Services within the Testbed's Dashboard), in principle each UC has its own Flavour (or Service template) defined in the Testbed, being "Energy", "SmartCity", "Cybersec" and "Nature" the ones that are to be used.
- sr_conf.geolocation, the geolocation provided by the user (e.g.: using a more precise GPS antenna for providing it), instead of the default one. By default, an IP based geolocation will be provided by the Device Runtime's cognit module (library).
- sr_conf.lat_to_pe, the user can set a latency to Provisioning Engine, otherwise Device Runtime cognit module will perform a probe to the PE in order to get a real value.
For M15, the purpose of DR is to show a rescheduling example (shown in examples/create_offl_update_offl.py
) where requirements by the user are changed, which may trigger a rescheduling of the SR VM. In order to do that, the current version defines the EnergySchedulingPolicy in two different ways:
Being sr_conf.scheduling_policies = [EnergySchedulingPolicy(X)]
- If X < 50: no tag will be set, which will schedule in one of the two nodes available in the Testbed infra.
- Else, "ENERGY_RENEWABLE=yes" tag will be set (which corresponds to the other node available in the Testbed infra).
- Example:
sr_conf.scheduling_policies = [EnergySchedulingPolicy(30)]
create SR
sr_conf.scheduling_policies = [EnergySchedulingPolicy(80)]
update SR # This may trigger a reschedule.
Note that doing it the other way around may cause a scheduling ERROR similar to this: