Home

Download

Higthligths

Firsteps

Tutorial

Advocacy

Specs&soluces

Docs

Faq

About AskApy

Contact

Admin

Specs & Soluces




CoolTyping


Who's never dreamt of being able to enter structured types straight from the command line ?
Nobody perhaps. But I do !
I want to pass complexes type like :
    _ bool, int, list, dict, date, horodate and obviously string,
directly from the command line.
And I want them to be natively interprated by my script with no tricky conversion job.

This is the purpose of CoolTyping.

Example

ask.py _t list --path [{dir:dir1,files:[file1,file2]}, {dir:dir2}] --check False
The parameters are natively converted to internal python types :
  • path is converted to a python list type.
    path : [{'dir': 'dir1', 'files': ['file1', 'file2']}, {'dir': 'dir2'}]
    Please note that recursive conversion of imbricated types is supported.
  • check is converted to a python boolean type.
    check : False
Note
Even in AskApy graphic mode form parmameters are always converted to a raw command line and
so far to a CoolTyped command line.
That mean that the content of each graphic component of the form is translated to a CoolTyped form.




WantedKeyword


I notice that every time I have a structured type as parameter, I always perform the same kind of
controls and checks on it. I get tired of this.
I just want a simple and straigth way to describe my parameter prescriptions.

This is the purpose of WantedKeyword (wk).

Example

ask.py _t list --path [{dir:dir1,files:[file1,file2]}, {dir:dir2}] --check False
As you've seen in the wk documentation paramters are described throught a dictionary of keys,
so for those two parameters I would just say this:
  • path : wk={'*type':'list'}
    or if I want a deeper control
    wk={\
        '*type': '*list', \
        '*dtype': {\
            'dir': {'*type':'str', '*required': True}, \
            'files': {'*type': 'list', '*ltype': {'*type':'str'} } \
        }\
    }
  • check : wk={'*type':'bool'}
Note
Parameters are described in the parameter descriptor file associated with your Apb.
In this description each parameter is associated to a wk description.
For more information see Apb.
It is the wk class witch is responsable of the unCoolTyping of the incomming parameter.




Template


Often in massive administration scripts, I duplicate huge amout of small configuration files
with a few delta of changes between the two copy.
I want a template system.

This is the purpose of Template.





AskApy aql and xql


I observe that I often dig in updating properties files (let us call them attribute files in a more pythonic way)
and xml file.
I want a ground tools with base understanding of this kind of files.

For that comes AskApy aql and AskApy xql.





Task lock


I notice that when I provide my administration scripts to third party users, I often need the same mechanismes.

Simultaneous access to the same resource with lock.
I dont want to bother with named pipes or semafor that are system specifics.

To that is devoted the locking mechanism see Cube.

Note
To activate the lock (the single access at a time) for a task,
this must be include in the Cube descriptor file of the Apb : lock apb_nolock="no".
For more information see Cube.





Authentification registry


Most of time my third party users have not the same status,
I want to check their accessability.

This the design of the Authentification registry.





Autorisation


When I provide the same script to users of many status,
I need some to be allow to some stuff and others not.
So I want to be free to allow a few parameters to some and not to the others.
For that I really need a fine grain autorisation mechanism.

AskApy allow autorisation check upon :

  • Servers
  • Cubes
  • Resources
  • Apbs
  • Tasks
  • Parameters
  • ...
See Cube or Server.





Cube


When I am pround of a peace of code I've made, I really would like to share it with the world,
but with nothing specific about my system in it.
That is the purpose of the isolated cube descriptors mechanism, that separate actual local systems artefacts,
like real users of real files name from the code.

See Cube.





Making deamons


I need deamons (a task doing a job in batch mode and that never dies).

For that purpose see Apb.

Example
In fact to make a deamon is as simple as that :

From the command line
Invocating the apb instance :
ask.py _l {boot:localhost~:8010,cub:mycub,apb:MyApb} _t myDeamonTask _u paul _p pass
Because the Apb is instanciated with a task parameter (_t), the ask command assume that this task must be called in batch mode.
You can still call other task on this same Apb instance :
ask.py _t hello -n john -a 30

From a python client
from apy.clt import ask
apb=ask.BApb(apb_ual={'boot':'localhost:8010', child:'child20@child0', 'cub':'mycub', 'apb':'MyApb'}, task='myDeamonTask', apb_user='paul', apb_password='pass')
Please note that ask.BApb (B for batch) is used instead of ask.IApb (I for interactive).
print apb.hello(name='john', age=30)





Return Objects


When working with a python client, sometime I wish that the called task could return a python object.

In AskApy all python types can be returned but if you want to return the instance of a custom class,
your class must extend the apy.tools.StructSerializable class.

See StructSerializable.

Note
The serialization/de-serialization mechanism is recursive, this mean if you have an attribute that refers to another instance,
made up from a class that extends StructSerializable, and so on, the whole will be serialized/de-serialized.
The path to your class must exist on the client.
Hidden attributes (starting with "__") are not serialized.





Re-entrance


When my deamon is running in batch mode, I still want to be able to talk to him.
All Apb AskApy instance are re-entrant as long as you still have its token you still can call a method on it (to retreive status for exemple).
You can even have a user at the phone, grab is token and call this same instance in live.





Persistence


I always get crazy when using SOAP beetween to call I lost my instance variable.
No ! if I say apb.setName('paul') in one instance, I restart my computer and
then say apb.getName() back on that same instance I want to see paul and not None.

AskApy have two persistences mechanism :
Re-entrance and Sessions (Sessions are specifics by user/login).





Shakers and Twins


I need to support heavy load access,
sometime upon the same (Interative or Batch) instance or not, or upon a server.

Askapy comes with two mecanismes for load support :

  • Internal clustering with Shakers
  • External clustering with Twins see Server




  • PoolPolicy


    Ok, ok that smells good, that re-entrance thing, but I do not want my Apbs instance increases crazily for each user invocation !
    For that comes AskApy PoolPolicy.
    You can statuate that : an Apb should allow an unique instance or a limited number of of them,
    for all users or by roles or by group or by pool.

    See Cube or Server.





    Kron


    Sometime I feel lazy and I really would appreciate that some task are trigered when
    I'm sleeping at 3 am !
    .
    See Kron





    Event


    I would like a task being trigered when an event occurs !

    See Event





    One point admin I


    10 years working scatered <-- architectures of servers mixed with firewall, router and proxies accross the country.
    I hate doing this :

    ssh server1
        ssh server2
            ssh server3
                ssh server4
                    mytask.sh

    Are you crazy ? in the 21 century ?

    I want to call mytask.sh on server4, straight from server1.
    I am not a sheep to jump like this <--.

    This is the purpose of Uniform Apb Locator (UAL) see ask or apb.

    Example
    Wherever a server is located in the architecture (or family),
    since I mention is name the request is routed to him, in this example I boot upon child10 but I want to join child60.
    ask.py _l {boot:localhost~:8010,child:child60@child0,cub:mycub,apb:MyApb} _u paul _p pass
    print apb.hello(name='john', age=30)

    Note
    Please note that bridges between family are allowed too.
    A few paramters like apb_force_route=[child20,child30] can be given to
    force AskApy to choose a particular route and not necessary the shortest.
    This mechanism can be disabled at all for a child (or server), or for role.




    One point admin II (*)


    Sometime I want to automate all my servers from one point.

    This is a good job for the Father.





    Flexible architecture (*)


    Sometimes I want to test all my archicteture but I do not have enought machines.
    AskApy makes it easy to create all your servers (childs) on the same machine
    test them and deploy them, lately, once you get the machines.





    Graphical interface


    Do not forget, I am lazy, once I've provided my script I want it to be also graphically accessible !

    AskApy comes with a framework with visual plugin components.
    Because your parameters are described in the parameter descriptor file,
    AskApy deductes an interface and selects the visual components based upon your parameter types.
    You and any user you allow can accesss directly to your Apb task interface.
    Like this:
    http://127.0.0.1:8012/cub/mycub/apb/MyApb/task/do_hello
    Syntax:
    http[s]://HOST_OR_IP:PORT/child/CHILD_NAME@FATHER_NAME[/tk/APB_TK][/group/GROUP_NAME]/cub/CUBE_NAME/apb/APB_NAME/task/do_TASK_NAME
    For more information about the syntax see ask.

    You can custom this interace using the framework.
    You can also create and share your visual component because they are plugins; this is the source of the component inputField.
    .
    See view.(*)
    .
    Note
    Your graphical interface is accessable by the web and also by the AskApy graphical command view.py.
    But remember that view.py is just using the graphical class ApbView.
    That mean that you can embed that class in any of your python application and have a graphical access
    to AskApy.