IRC logs of #tryton for Sunday, 2018-10-14

chat.freenode.net #tryton log beginning Sun Oct 14 00:00:01 CEST 2018
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton00:10
-!- cryptic(~cryptic@142.196.170.87) has joined #tryton01:10
-!- thaneor(~lenovo3@179.26.158.204) has joined #tryton02:10
-!- rmu(~robert@cpe90-146-69-94.liwest.at) has joined #tryton02:10
-!- cryptic(~cryptic@142.196.170.87) has joined #tryton02:10
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton02:10
-!- yangoon(~mathiasb@i59F521FA.versanet.de) has joined #tryton04:10
-!- cryptic(~cryptic@142.196.170.87) has joined #tryton06:10
-!- rmu(~robert@cpe90-146-69-94.liwest.at) has joined #tryton08:10
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton09:10
LordVanhi10:10
-!- thaneor(~lenovo3@179.26.62.36) has joined #tryton14:10
LordVanI am trying to access the party objects in my trytond install using proteus in ipython .. but  i think I am going about it wrong .. anyone here can tell me the steps i need for this to work?14:10
LordVanI did do config.set_trytond(..)  , then tried to do Party.browse(Transaction().context.get('active_ids')) but that doesn't seem to work14:10
LordVanam I missing something?14:10
semarieLordVan: I am usually use config.set_xmlrpc(uri), but else for get all active party I would do:14:10
semarieParty = Model.get('party.party')14:10
semarieall_parties = Party.find()14:10
LordVansemarie, ah cool thanks that works ..looks like I was going about it the wrong(?) way aroudn ;)14:10
LordVansemarie, one step closer to writing my data import14:10
semarieand find() could be used to filter: Party.find([('name', 'like', 'RA%')])14:10
semarieLordVan: if you use proteus for importing data, it could be really slow due to reauthentification for each request14:10
LordVansemarie, well I am not sure yet if i was going to use proteus14:10
LordVanbut i am trying some stuff with it14:10
LordVansemarie, how would you import data?14:10
semarieI use proteus with some customization :)14:10
semariesee https://p.iotek.org/afa14:10
semarieI have stolen some code from tryton client to do it14:10
semarieassuming the content saved as 'session.py', I have the following in my script14:10
semariefrom session import *14:10
semarieconfig = tryton_connect('myhostname', 'mydatabase', 'admin', 'adminpassword')14:10
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton14:10
LordVaninteresting.. not sure if I'll really use it though  ^^ (can't claim i completely understand what it does at this point) .. also performance Is not really much of an issue for me in this case14:10
semarieLordVan: it changes the transport used for proteus to use session-otken-authentification instead of http-auth ; and do http connection reuse (instead of new tcp for each request)14:10
LordVansemarie, yeah i guessed something like that, butr wasn't sure about the code/details ;)14:10
semarieparts comes from tryton/tryton/jsonrpc.py14:10
LordVan;)14:10
LordVansemarie, what is the advantage of config.set_xmlrpc(uri) ? not needing the tryton config ?14:10
semariemy server isn't local14:10
LordVanalso I need to import approximately 1700 party entries from dolibarr, so it is not that much of an issue from a time point of view ^^14:10
LordVanactually make that 3000-4000 (dolibarr has people and companies in seperate tables)14:10
LordVanstill relatively small numbers14:10
LordVansemarie, ah i see what you mean14:10
LordVando you have an example for the xmlrpc uri?14:10
semariebut I wonder if using set_trytond() would be more efficient than set_xmlrpc() for importing14:10
LordVani have absolutely no idea .. maybe cedk can answer that?14:10
semarieconfig.setxmlrpc('http://username:password@server:port/database/')14:10
LordVanthanks14:10
LordVansemarie, well just quickly checking netstat when you use set_trytond it connects on tcp port 5007014:10
LordVanerr wait14:10
semarieLordVan: by using set_trytond() you are directly connect to database, whereas using set_xmlrpc() you connect to http server. and my script only optimizes http connection14:10
LordVanyes14:10
LordVani just noticed14:10
LordVanit connects directly to the db14:10
semarieso it should be more efficient :)14:10
LordVanso i think set_trytond should not have the performance penalty you mentioned14:10
semarieexactly14:10
LordVantcp        0      0 192.168.0.21:50070      192.168.0.19:5432       ESTABLISHED 14747/python3.514:10
LordVan;)14:10
LordVanand since for me there is no problem running the import script on the tryton host/VM i will do that ;)14:10
semarieACTION tends to avoid exposing postgresql on the network14:10
LordVanthere is one thing i am not looking forward to though .. dolibarr does sort of require you to have an entry for the (business) partner and one for the actual person .. in case it is the same entity you end up with 2 entries .. also when one person works for multiple partners (as contractor for example) you ahve to add that person X times14:10
LordVanso got to figure out how i'll handle that in my import14:10
LordVanmeh14:10
LordVansemarie, well i wouldn'T expose postgres publically to the network either .. but i do have both postgrs and tryton in a VM so i can mov ethe VM<->VM communication to a different vlan/subnet easily anyway and maybe add some iptables stuff (though in my case i am not too worried about attacks)14:10
cedkI had not the begining of the conversation so I do not know the topic15:10
LordVancedk, just if set_trytond is faster than set_xmlrpc15:10
LordVan(for data import)15:10
cedkhard to say, I think it depends of the proteus script15:10
cedkoften it is the way proteus is used that can make it slow or fast15:10
LordVancedk, well semarie was saying how the xmlrpc does re-authentification15:10
cedkthe check of session or the login should be quite similar15:10
semariecedk: I see a big slow down with http-auth15:10
cedkI saw that it was also mention of connection reuse15:10
semariespecially since we changed the hash method15:10
cedkbut I think on recent python version, it does keep the connection open (or may be we need to set a parameter)15:10
semarieI use python 3.615:10
cedksemarie: indeed the bcrypt hash is slow15:10
LordVanhmm why is Party = Model.get('party.party')  ;; newp = Party.create({'name': 'testparty from proteus',}) giving me TypeError: create() missing 1 required positional argument: 'vlist'15:10
cedkbut I do not think it is a good solution to use session for scripts as the session can expire at any time15:10
LordVanor do I need to use the Pool to get Party to be able to create?15:10
semarieLordVan: https://p.iotek.org/v3b15:10
semariebut you will need to adapt15:10
semarieACTION is searching some another doc15:10
LordVanah15:10
semarieREADME :)15:10
semariehttp://hg.tryton.org/proteus/file/tip/README#l3315:10
LordVani just needed to do newp=Party(..)15:10
LordVan;)15:10
LordVannot call the method .create()15:10
cedkLordVan: create takes a list of values and need a context15:10
LordVanyes15:10
LordVancedk, btw you mentioned before that you'd be interested in a dolibarr data import ? (I do intend to put my scripts (mostly) on my github / blog)15:10
semarieLordVan: good example are tests scenario in modules15:10
LordVansemarie, yes i was looking there as well15:10
semariebut pick *scenario* not plain py files ;)15:10
LordVan;)15:10
LordVanyeah but I am making some good progress now .. though I think I will need to write a module first to add some additional fields and stuff but will see about that15:10
cedksemarie, LordVan: about proteus performance, I think if it is for an initial import, it is better to run on on the server as a one shot script15:10
LordVancedk, yes that was my plan15:10
cedkif it is for a script that run periodically, if it has few calls than proteux with XML-RPC is good enough15:10
cedkbut if it has a large number of calls, I think it is better to create a module with a dedicated API and do the work on the server side15:10
LordVanwell I plan to replace dolibarr with tryton so it will really just be that one-off import15:10
cedkbut if someone really wants to improve perf of proteus for the login, I think the best option would be able to configure proteus with a existing session15:10
cedkbut I do not think we need to manage it transparently15:10
cedkanother possible improvement: https://bugs.tryton.org/issue272315:10
LordVananway i gtg for now .. thanks again semarie and cedk  ;)15:10
cedkfilled https://bugs.tryton.org/issue778315:10
-!- semarie(~semarie@unaffiliated/semarie) has joined #tryton22:10
-!- csotelo(~csotelo@2800:200:f400:23c1:83dd:9b29:5c88:1c4c) has joined #tryton22:10

Generated by irclog2html.py 2.16.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!