Home

Download

Higthligths

Firsteps

Tutorial

Advocacy

Specs&soluces

Docs

Faq

About AskApy

Contact

Admin

Fastutorial




Quick
Rather than creating your own Apb you can use those already provided in the cube mycub.
and enhance them to fullfill your needs.
You may add new methods, new paramters or even design the view.call and the view.return on them.
From the command line to have more information about
mycub type : doc.py --child child10@child0 mycub
          doc.py --child child10@child0 mycub.mypackage1.mypackage2.mymodule
          doc.py --child child10@child0 mycub.mypackage1.mypackage2.mymodule.MyApb
          doc.py --child child10@child0 mycub.mypackage1.mypackage2.mymodule.MyApb.do_hello
     or
          mycub type : ask.py _l {boot:localhost~:8010,child:child20@child0,cub:mycub,apb:MyApb} _u paul _p pass
          ask.py _t help -c
          ask.py _t help -m
          ask.py _t help
          ask.py _t hello -h
          ask.py _t help



Start and Stop


This start and stop child10 of family child0.

Start
child.py child10@child0 -s

Stop
child.py child10@child0 -s -k _u admin _p pass





View


From a browser
In the address bar type: http://localhost:8010

From the AskApy graphical tools
from a command line type: view.py http://localhost:8012





Call an Apb


From the command line
Invocating the apb instance (this wont be repeated for the next examples):
ask.py _l {boot:localhost~:8010,child:child20@child0,cub:mycub,apb:MyApb} _u paul _p pass
Because child20 belong to the same family of the boot child (child10) the request is automatically routed to child20.
Bridges between families exist also.

Calling a task upon this instance:
ask.py _t hello -n john -a 30
You can also use AskApy control keyword parameters (apb_nolock, apb_repeat, apb_withcache, apb_logparent, apb_logno, apb_suggest_route, ...),
to force a behaviour to a task.

From a python client
from apy.clt import ask
apb=ask.IApb(apb_ual={'boot':'localhost:8010', child:'child20@child0', 'cub':'mycub', 'apb':'MyApb'}, apb_user='paul', apb_password='pass')
If child is omited the request is assumed by the boot child.
print apb.hello(name='john', age=30)

View
From the browser:
Type in the address bar http://127.0.0.1:8012/child/child20@child0/cub/mycub/apb/MyApb/task/do_hello
From the AskApy graphical tools:
From a command line type view.py http://127.0.0.1:8010/child/child20@child0/cub/mycub/apb/MyApb/task/do_hello

Run this example
From a command line type: mycl.py call_hello or mycl.py call_hello cde





Get a file


From the command line
Calling the client's special methods cget upon the Apb instance:
ask.py _t cget --rsc test/datas.gz --trg c:\\mydir

From a python client
apb.apb_cget('test/datas.gz', 'c:\\mydir')

The client will open as many threads (up to 10 threads) as necessary to speed up the download of a file or a directory.

Run this example
From a command line type: mycl.py cget or mycl.py cget cde





Put a file


From the command line
Calling the client's special methods cput upon the Apb instance:
ask.py _t cput --src c:\\mydir\\datas.gz --rsc test

From a python client
apb.apb_cput(src='c:\\mydir\\datas.gz', rsc='test')

The client will open as many threads (up to 10 threads) as necessary to speed up the upload of a file or a directory.

Run this example
From a command line type: mycl.py cput or mycl.py cput cde





Scan the Apb log


From the command line
Calling the client's special methods cscanlog upon the Apb instance:
ask.py _t cscanlog --log stdout_log --trg c:\\mydir

From a python client
apb.apb_cscanlog(log='stdout_log', trg='c:\\mydir')

Many parameters and options are provided to query the contents of the Apb instance's log or of the last run task.
Dig in mycl.py for samples.

Run this example
From a command line type: mycl.py cscanlog or mycl.py cscanlog cde





Get the Apb log


From the command line
Calling the client's special methods cgetlog upon the Apb instance:
ask.py _t cgetlog --log stdout_log --trg c:\\mydir

From a python client
apb.apb_cgetlog(tk=None, log='stdout_log', trg='c:\\mydir')

It also possible to get the log file of the last run task.
See mycl.py for samples.

Run this example
From a command line type: mycl.py cgetlog or mycl.py cgetlog cde





Tail the Apb log


From the command line
Calling the client's special methods ctailog upon the Apb instance:
ask.py _t ctailog --log stdout_log --trg c:\\mydir

From a python client
apb.apb_ctailog(log='stdout_log', trg='c:\\mydir')

Run this example
From a command line type: mycl.py ctailog or mycl.py ctailog cde





Tail a file


From the command line
Calling the client's special methods ctail upon the Apb instance:
ask.py _t ctail --rsc test/test.dat --trg c:\\mydir

From a python client
apb.apb_ctail('test/test.dat', 'c:\\mydir')

Update the resource file test/test.dat on another terminal and see what happens.

Run this example
From a command line type: mycl.py ctail or mycl.py ctail cde





Send AskApy Xql and Aql orders using the Gql facade


From the command line
Invocating the ApbService instance:
ask.py _l {boot:localhost~:8010,cub:askapy,apb:ApbService} _u paul _p pass

Calling the gql task upon this instance to send an AskApy Xql order:
ask.py _t gql --req select * at tag1.tag2.tag3 from test/xmlmk.xml type xml
or
ask.py _t gql --req duplicate tag1.tag2.tag3 where at32=[2] at tag1.tag2 from test/xmlmk.xml type xml

Calling the gql task upon this instance to send an AskApy Aql order:
ask.py _t gql --req update set champ3 = "{ccc:a3,ddd:blue sky}" from test/attrmk.attrs type attr --xdoCoolTyping True --xdoAppend True

From a python client
from apy.clt import ask
apb=ask.IApb(apb_ual={'boot':'localhost:8010', 'cub':'askapy', 'apb':'ApbService'}, apb_user='paul', apb_password='pass')

Send an AskApy Xql order:
req='ask.py _t gql --req select * at tag1.tag2.tag3 from test/xmlmk.xml type xml'
or
req='ask.py _t gql --req duplicate tag1.tag2.tag3 where at32=[2] at tag1.tag2 from test/xmlmk.xml type xml'
print apb.gql(req)

Send an AskApy Aql order:
req='ask.py _t gql --req update set champ3 = {ccc:a3,ddd:blue sky} from test/attrmk.attrs type attr --xdoCoolTyping True --xdoAppend True'
print apb.gql(req, xdoAppend=True, xdoCoolTyping=True)

Run this example
From a command line type: mycl.py gql or mycl.py gql cde





Control the Event system from the client


From the command line
Listen:
3. Register the task hello for listening:
ask.py _t listen -e {mod:apy.evt,cls:evtFile,hasChanged:True,fileName:fic2} -t hello -a TASK_TK
Send:
4. Trigger this event:
ask.py _t send -e {mod:apy.evt,cls:evtFile,hasChanged:True,fileName:fic2} -c {name:charlie,age:35}

From a python client
Listen:
eb.listen(event=evtFile(hasChanged=True, fileName='fic2'), task='hello', apbTk=tk)
Send:
eb.send( event=evtFile(hasChanged=True, fileName='fic2'), callp=CallParameters(name='charlie', age=35) )

To check out the other steps and run this example
From a command line type: mycl.py msg or mycl.py msg cde





Control the Kron scheduler agenda from the client


From the command line
Listen:
3. Register the task hello:
ask.py _t register -e {minute:[0,15,30,45]} -t hello-c {name:charlie,age:35} -a TASK_TK

From a python client
Register the task hello:
eb.register( event=evtKron(minute='0,15,30,45'), apbTk=TASK_TK, task='hello', callp=CallParameters(name='charlie', age=35) )

To check out the other steps and run this example
From a command line type: mycl.py kron or mycl.py kron cde