Subject: [Anima] ASA life cycle

From: Brian E Carpenter <[email-masked]>
Date: Wed, 3 Feb 2021 16:58:06 +1300

Hi,

Thinking a little more about the ANIMA ecosystem, I decided
to do some quick prototyping of some of the ideas on the
Autonomic Service Agent (ASA) life cycle that are in
draft-ietf-anima-asa-guidelines (and in more detail in expired
draft-peloso-anima-autonomic-function).

So I wrote a very crude "ASA loader" that can load (and unload)
multiple ASAs onto the same GRASP instance. All in Python, of
course. I learned quite a lot about how to dynamically load
Python code into a running Python module, but that's an
implementation detail. It's no more than a proof of concept.

I concluded that the only new feature needed, as far as the
ASA programmer is concerned, is one function that must be called
regularly in the main loop. I called it checkrun(), and if it
returns True the ASA may continue, and if it returns False,
the ASA must exit gracefully (i.e. conclude all current
actions first).

The code is a new module 'ASA_loader.py' at
https://github.com/becarpenter/graspy

The only documentation is in the code itself, as follows:

"""
Experimental ASA Loader. Definitely not production code.
This is just for proof of concept. See module graspi.py
for copyright and licence info.

An ASA handled by the loader must call
   graspi.checkrun(asa_handle, asa_name)
regularly in its main loop. If the function
returns False, the ASA must gracefully close down
all operations and sub-threads and then exit.

The ASA loader regularly checks the file 'asafs.txt'
and (re)loads any modules listed in the file that are
not already running. Each module will be a separate
Python thread. The check is repeated after one minute.

If an ASA module exits (gracefully or by an exception)
it will be reloaded (after up to one minute).

If a module name in the file is preceded by "-",
the ASA will be signalled to stop via checkrun()
and unloaded (after up to one minute).

A line in the file starting with "#" is a comment.
"""

Regards
     Brian