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 #tryton22:45
-!- cryptic(~cryptic@142.196.170.87) has joined #tryton23:47
-!- thaneor(~lenovo3@179.26.158.204) has joined #tryton00:02
-!- rmu(~robert@cpe90-146-69-94.liwest.at) has joined #tryton00:34
-!- cryptic(~cryptic@142.196.170.87) has joined #tryton00:38
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton00:58
-!- yangoon(~mathiasb@i59F521FA.versanet.de) has joined #tryton02:40
-!- cryptic(~cryptic@142.196.170.87) has joined #tryton04:20
-!- rmu(~robert@cpe90-146-69-94.liwest.at) has joined #tryton06:25
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton07:38
LordVanhi08:39
-!- thaneor(~lenovo3@179.26.62.36) has joined #tryton12:05
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?12:15
LordVanI did do config.set_trytond(..)  , then tried to do Party.browse(Transaction().context.get('active_ids')) but that doesn't seem to work12:17
LordVanam I missing something?12:17
semarieLordVan: I am usually use config.set_xmlrpc(uri), but else for get all active party I would do:12:28
semarieParty = Model.get('party.party')12:28
semarieall_parties = Party.find()12:28
LordVansemarie, ah cool thanks that works ..looks like I was going about it the wrong(?) way aroudn ;)12:29
LordVansemarie, one step closer to writing my data import12:30
semarieand find() could be used to filter: Party.find([('name', 'like', 'RA%')])12:30
semarieLordVan: if you use proteus for importing data, it could be really slow due to reauthentification for each request12:36
LordVansemarie, well I am not sure yet if i was going to use proteus12:37
LordVanbut i am trying some stuff with it12:37
LordVansemarie, how would you import data?12:37
semarieI use proteus with some customization :)12:37
semariesee https://p.iotek.org/afa12:37
semarieI have stolen some code from tryton client to do it12:38
semarieassuming the content saved as 'session.py', I have the following in my script12:38
semariefrom session import *12:38
semarieconfig = tryton_connect('myhostname', 'mydatabase', 'admin', 'adminpassword')12:38
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton12:41
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 case12:41
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)12:43
LordVansemarie, yeah i guessed something like that, butr wasn't sure about the code/details ;)12:43
semarieparts comes from tryton/tryton/jsonrpc.py12:43
LordVan;)12:43
LordVansemarie, what is the advantage of config.set_xmlrpc(uri) ? not needing the tryton config ?12:44
semariemy server isn't local12:44
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 ^^12:44
LordVanactually make that 3000-4000 (dolibarr has people and companies in seperate tables)12:45
LordVanstill relatively small numbers12:45
LordVansemarie, ah i see what you mean12:45
LordVando you have an example for the xmlrpc uri?12:46
semariebut I wonder if using set_trytond() would be more efficient than set_xmlrpc() for importing12:48
LordVani have absolutely no idea .. maybe cedk can answer that?12:48
semarieconfig.setxmlrpc('http://username:password@server:port/database/')12:48
LordVanthanks12:48
LordVansemarie, well just quickly checking netstat when you use set_trytond it connects on tcp port 5007012:49
LordVanerr wait12:50
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 connection12:50
LordVanyes12:50
LordVani just noticed12:50
LordVanit connects directly to the db12:50
semarieso it should be more efficient :)12:50
LordVanso i think set_trytond should not have the performance penalty you mentioned12:50
semarieexactly12:50
LordVantcp        0      0 192.168.0.21:50070      192.168.0.19:5432       ESTABLISHED 14747/python3.512:50
LordVan;)12:50
LordVanand since for me there is no problem running the import script on the tryton host/VM i will do that ;)12:50
semarieACTION tends to avoid exposing postgresql on the network12:51
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 times12:52
LordVanso got to figure out how i'll handle that in my import12:52
LordVanmeh12:52
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)12:54
cedkI had not the begining of the conversation so I do not know the topic13:00
LordVancedk, just if set_trytond is faster than set_xmlrpc13:00
LordVan(for data import)13:01
cedkhard to say, I think it depends of the proteus script13:02
cedkoften it is the way proteus is used that can make it slow or fast13:02
LordVancedk, well semarie was saying how the xmlrpc does re-authentification13:03
cedkthe check of session or the login should be quite similar13:04
semariecedk: I see a big slow down with http-auth13:04
cedkI saw that it was also mention of connection reuse13:05
semariespecially since we changed the hash method13:05
cedkbut I think on recent python version, it does keep the connection open (or may be we need to set a parameter)13:06
semarieI use python 3.613:07
cedksemarie: indeed the bcrypt hash is slow13:07
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'13:08
cedkbut I do not think it is a good solution to use session for scripts as the session can expire at any time13:09
LordVanor do I need to use the Pool to get Party to be able to create?13:10
semarieLordVan: https://p.iotek.org/v3b13:11
semariebut you will need to adapt13:11
semarieACTION is searching some another doc13:11
LordVanah13:12
semarieREADME :)13:12
semariehttp://hg.tryton.org/proteus/file/tip/README#l3313:12
LordVani just needed to do newp=Party(..)13:12
LordVan;)13:12
LordVannot call the method .create()13:12
cedkLordVan: create takes a list of values and need a context13:12
LordVanyes13:13
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)13:13
semarieLordVan: good example are tests scenario in modules13:13
LordVansemarie, yes i was looking there as well13:14
semariebut pick *scenario* not plain py files ;)13:14
LordVan;)13:15
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 that13:15
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 script13:17
LordVancedk, yes that was my plan13:17
cedkif it is for a script that run periodically, if it has few calls than proteux with XML-RPC is good enough13:18
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 side13:19
LordVanwell I plan to replace dolibarr with tryton so it will really just be that one-off import13:19
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 session13:22
cedkbut I do not think we need to manage it transparently13:23
cedkanother possible improvement: https://bugs.tryton.org/issue272313:24
LordVananway i gtg for now .. thanks again semarie and cedk  ;)13:28
cedkfilled https://bugs.tryton.org/issue778313:32
-!- semarie(~semarie@unaffiliated/semarie) has joined #tryton20:01
-!- csotelo(~csotelo@2800:200:f400:23c1:83dd:9b29:5c88:1c4c) has joined #tryton20:14

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