chat.freenode.net #tryton log beginning Sun Oct 14 00:00:01 CEST 2018 | ||
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton | 22:45 | |
-!- cryptic(~cryptic@142.196.170.87) has joined #tryton | 23:47 | |
-!- thaneor(~lenovo3@179.26.158.204) has joined #tryton | 00:02 | |
-!- rmu(~robert@cpe90-146-69-94.liwest.at) has joined #tryton | 00:34 | |
-!- cryptic(~cryptic@142.196.170.87) has joined #tryton | 00:38 | |
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton | 00:58 | |
-!- yangoon(~mathiasb@i59F521FA.versanet.de) has joined #tryton | 02:40 | |
-!- cryptic(~cryptic@142.196.170.87) has joined #tryton | 04:20 | |
-!- rmu(~robert@cpe90-146-69-94.liwest.at) has joined #tryton | 06:25 | |
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton | 07:38 | |
LordVan | hi | 08:39 |
---|---|---|
-!- thaneor(~lenovo3@179.26.62.36) has joined #tryton | 12:05 | |
LordVan | I 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 |
LordVan | I did do config.set_trytond(..) , then tried to do Party.browse(Transaction().context.get('active_ids')) but that doesn't seem to work | 12:17 |
LordVan | am I missing something? | 12:17 |
semarie | LordVan: I am usually use config.set_xmlrpc(uri), but else for get all active party I would do: | 12:28 |
semarie | Party = Model.get('party.party') | 12:28 |
semarie | all_parties = Party.find() | 12:28 |
LordVan | semarie, ah cool thanks that works ..looks like I was going about it the wrong(?) way aroudn ;) | 12:29 |
LordVan | semarie, one step closer to writing my data import | 12:30 |
semarie | and find() could be used to filter: Party.find([('name', 'like', 'RA%')]) | 12:30 |
semarie | LordVan: if you use proteus for importing data, it could be really slow due to reauthentification for each request | 12:36 |
LordVan | semarie, well I am not sure yet if i was going to use proteus | 12:37 |
LordVan | but i am trying some stuff with it | 12:37 |
LordVan | semarie, how would you import data? | 12:37 |
semarie | I use proteus with some customization :) | 12:37 |
semarie | see https://p.iotek.org/afa | 12:37 |
semarie | I have stolen some code from tryton client to do it | 12:38 |
semarie | assuming the content saved as 'session.py', I have the following in my script | 12:38 |
semarie | from session import * | 12:38 |
semarie | config = tryton_connect('myhostname', 'mydatabase', 'admin', 'adminpassword') | 12:38 |
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton | 12:41 | |
LordVan | interesting.. 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 case | 12:41 |
semarie | LordVan: 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 |
LordVan | semarie, yeah i guessed something like that, butr wasn't sure about the code/details ;) | 12:43 |
semarie | parts comes from tryton/tryton/jsonrpc.py | 12:43 |
LordVan | ;) | 12:43 |
LordVan | semarie, what is the advantage of config.set_xmlrpc(uri) ? not needing the tryton config ? | 12:44 |
semarie | my server isn't local | 12:44 |
LordVan | also 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 |
LordVan | actually make that 3000-4000 (dolibarr has people and companies in seperate tables) | 12:45 |
LordVan | still relatively small numbers | 12:45 |
LordVan | semarie, ah i see what you mean | 12:45 |
LordVan | do you have an example for the xmlrpc uri? | 12:46 |
semarie | but I wonder if using set_trytond() would be more efficient than set_xmlrpc() for importing | 12:48 |
LordVan | i have absolutely no idea .. maybe cedk can answer that? | 12:48 |
semarie | config.setxmlrpc('http://username:password@server:port/database/') | 12:48 |
LordVan | thanks | 12:48 |
LordVan | semarie, well just quickly checking netstat when you use set_trytond it connects on tcp port 50070 | 12:49 |
LordVan | err wait | 12:50 |
semarie | LordVan: 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 connection | 12:50 |
LordVan | yes | 12:50 |
LordVan | i just noticed | 12:50 |
LordVan | it connects directly to the db | 12:50 |
semarie | so it should be more efficient :) | 12:50 |
LordVan | so i think set_trytond should not have the performance penalty you mentioned | 12:50 |
semarie | exactly | 12:50 |
LordVan | tcp 0 0 192.168.0.21:50070 192.168.0.19:5432 ESTABLISHED 14747/python3.5 | 12:50 |
LordVan | ;) | 12:50 |
LordVan | and since for me there is no problem running the import script on the tryton host/VM i will do that ;) | 12:50 |
semarie | ACTION tends to avoid exposing postgresql on the network | 12:51 |
LordVan | there 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 times | 12:52 |
LordVan | so got to figure out how i'll handle that in my import | 12:52 |
LordVan | meh | 12:52 |
LordVan | semarie, 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 |
cedk | I had not the begining of the conversation so I do not know the topic | 13:00 |
LordVan | cedk, just if set_trytond is faster than set_xmlrpc | 13:00 |
LordVan | (for data import) | 13:01 |
cedk | hard to say, I think it depends of the proteus script | 13:02 |
cedk | often it is the way proteus is used that can make it slow or fast | 13:02 |
LordVan | cedk, well semarie was saying how the xmlrpc does re-authentification | 13:03 |
cedk | the check of session or the login should be quite similar | 13:04 |
semarie | cedk: I see a big slow down with http-auth | 13:04 |
cedk | I saw that it was also mention of connection reuse | 13:05 |
semarie | specially since we changed the hash method | 13:05 |
cedk | but I think on recent python version, it does keep the connection open (or may be we need to set a parameter) | 13:06 |
semarie | I use python 3.6 | 13:07 |
cedk | semarie: indeed the bcrypt hash is slow | 13:07 |
LordVan | hmm 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 |
cedk | but I do not think it is a good solution to use session for scripts as the session can expire at any time | 13:09 |
LordVan | or do I need to use the Pool to get Party to be able to create? | 13:10 |
semarie | LordVan: https://p.iotek.org/v3b | 13:11 |
semarie | but you will need to adapt | 13:11 |
semarie | ACTION is searching some another doc | 13:11 |
LordVan | ah | 13:12 |
semarie | README :) | 13:12 |
semarie | http://hg.tryton.org/proteus/file/tip/README#l33 | 13:12 |
LordVan | i just needed to do newp=Party(..) | 13:12 |
LordVan | ;) | 13:12 |
LordVan | not call the method .create() | 13:12 |
cedk | LordVan: create takes a list of values and need a context | 13:12 |
LordVan | yes | 13:13 |
LordVan | cedk, 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 |
semarie | LordVan: good example are tests scenario in modules | 13:13 |
LordVan | semarie, yes i was looking there as well | 13:14 |
semarie | but pick *scenario* not plain py files ;) | 13:14 |
LordVan | ;) | 13:15 |
LordVan | yeah 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 that | 13:15 |
cedk | semarie, 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 script | 13:17 |
LordVan | cedk, yes that was my plan | 13:17 |
cedk | if it is for a script that run periodically, if it has few calls than proteux with XML-RPC is good enough | 13:18 |
cedk | but 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 side | 13:19 |
LordVan | well I plan to replace dolibarr with tryton so it will really just be that one-off import | 13:19 |
cedk | but 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 session | 13:22 |
cedk | but I do not think we need to manage it transparently | 13:23 |
cedk | another possible improvement: https://bugs.tryton.org/issue2723 | 13:24 |
LordVan | anway i gtg for now .. thanks again semarie and cedk ;) | 13:28 |
cedk | filled https://bugs.tryton.org/issue7783 | 13:32 |
-!- semarie(~semarie@unaffiliated/semarie) has joined #tryton | 20:01 | |
-!- csotelo(~csotelo@2800:200:f400:23c1:83dd:9b29:5c88:1c4c) has joined #tryton | 20:14 |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!