Re: deadlock risk from using cache a load time

2016-01-26 Thread Aymeric Augustin
> On 26 janv. 2016, at 00:43, John Bazik  wrote:
> 
> In db/models/base.py, in model_unpickle, I see this:
> 
> if isinstance(model_id, tuple):
> if not apps.ready:
> apps.populate(settings.INSTALLED_APPS)
> model = apps.get_model(*model_id)
> 
> Can that test instead be "if not apps.models_ready"?  That would prevent the 
> nested call and fix my problem.

That would be consistent with the implementation of apps.get_model() which only 
checks models_ready.

However I think there's a bigger problem with this code. apps.populate() should 
only be called by django.setup(). I think we should revert 
108b8bf852c76855ed98f5abe55db1da845598e7.

External scripts must call django.setup() before using the ORM, whether they’re 
unpickling models or doing anything else with them. This was a known backwards 
incompatibility in 1.7: 
https://docs.djangoproject.com/en/1.9/releases/1.7/#standalone-scripts 


-- 
Aymeric.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/EE1D8AB9-3741-45D6-ADD7-0A94C7F487F4%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.


Re: deadlock risk from using cache a load time

2016-01-26 Thread Florian Apolloner
On Tuesday, January 26, 2016 at 9:52:01 AM UTC+1, Aymeric Augustin wrote:
>
> However I think there's a bigger problem with this code. apps.populate() 
> should only be called by django.setup(). I think we should 
> revert 108b8bf852c76855ed98f5abe55db1da845598e7.
>

Revert yes, but a check like that should stay and maybe raise an error 
instead of calling apps.populate.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/94fec703-55df-4831-984c-6f6bc298e4e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Module Index

2016-01-26 Thread Doug Epling
shouldn't this  be here:  
https://docs.djangoproject.com/en/1.9/py-modindex/#t

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/422bff97-3cee-4302-8fd7-b2ecb443b88f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Module Index

2016-01-26 Thread Tim Graham
Feel free to file a ticket and/or submit a patch.

On Tuesday, January 26, 2016 at 6:05:55 AM UTC-5, Doug Epling wrote:
>
> shouldn't this  be here:  
> https://docs.djangoproject.com/en/1.9/py-modindex/#t
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/111535ef-3047-4f8a-8999-f22678e3f91f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Module Index

2016-01-26 Thread Ned Batchelder

On 1/25/16 10:05 PM, Doug Epling wrote:
shouldn't this  be here: 
https://docs.djangoproject.com/en/1.9/py-modindex/#t


The module index is built from directives like ".. module: 
django.template.loader" in the various .txt files, like 
docs/topics/templates.txt.  Adding more directives will add entries to 
the module index.


--Ned.

--
You received this message because you are subscribed to the Google Groups "Django 
developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/56A762B9.1070901%40nedbatchelder.com.
For more options, visit https://groups.google.com/d/optout.


Re: deadlock risk from using cache a load time

2016-01-26 Thread Aymeric Augustin

> On 26 janv. 2016, at 09:57, Florian Apolloner  wrote:
> 
> Revert yes, but a check like that should stay and maybe raise an error 
> instead of calling apps.populate.


The following line, `apps.get_model(…)`, raises an exception when `not 
apps.models_ready`.

-- 
Aymeric.


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/A07C49F0-B2E7-47C7-8E69-ACC346C40A94%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.


Re: deadlock risk from using cache a load time

2016-01-26 Thread Tim Graham
Oops, here's the pull request: https://github.com/django/django/pull/6044

WIth the fix reverted and the missing django.setup() call, the exception is 
"django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.". I 
don't think we need a different exception in model_unpickle(), but maybe 
that message could mention a missing call to django.setup() as a common 
cause? Something like "Models aren't loaded yet. Are you missing 
django.setup() in a standalone script?".

On Tuesday, January 26, 2016 at 7:53:05 AM UTC-5, Aymeric Augustin wrote:
>
>
> > On 26 janv. 2016, at 09:57, Florian Apolloner  > wrote: 
> > 
> > Revert yes, but a check like that should stay and maybe raise an error 
> instead of calling apps.populate. 
>
>
> The following line, `apps.get_model(…)`, raises an exception when `not 
> apps.models_ready`. 
>
> -- 
> Aymeric. 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/ec37323c-43f0-4e1f-8975-2b6835fc9820%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Module Index

2016-01-26 Thread Doug Epling
Tim -- 

I guess that was an affirmative answer to my question.  So I will give it 
some thought, read the relevant docs, and do what you say.

Thanks, 

On Tuesday, January 26, 2016 at 6:52:08 AM UTC-5, Tim Graham wrote:
>
> Feel free to file a ticket and/or submit a patch.
>
> On Tuesday, January 26, 2016 at 6:05:55 AM UTC-5, Doug Epling wrote:
>>
>> shouldn't this  be here:  
>> https://docs.djangoproject.com/en/1.9/py-modindex/#t
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e7c4dd4d-1421-4cf3-84fa-628bb9ad9dfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: deadlock risk from using cache a load time

2016-01-26 Thread Aymeric Augustin
On 26 janv. 2016, at 14:40, Tim Graham  wrote:

> Something like "Models aren't loaded yet. Are you missing django.setup() in a 
> standalone script?".


We’ve had this discussion before, cf. 8121860be4b9379d107959290e5748bbaf6de1fe 
;-)

The exception message could point to the “Troubleshooting” section of 
docs/ref/applications.txt. We could extend the explanation of what constitutes 
a “standalone script” — many devs won’t expect celery / rq to fall in this 
category.

-- 
Aymeric.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/EDF06A72-9B84-40C7-B00F-C2FF662AB970%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.


Re: deadlock risk from using cache a load time

2016-01-26 Thread Tim Graham
Oops again... sorry for poor memory about the error message.

Regarding the original issue -- in Claude's use case, he says that calling 
django.setup() before unpickling is not doable, as an external tool is 
doing the unpickling of model data. Should we say that unpickling model 
data from non-Django code is no longer possible?

On Tuesday, January 26, 2016 at 2:13:21 PM UTC-5, Aymeric Augustin wrote:
>
> On 26 janv. 2016, at 14:40, Tim Graham > 
> wrote: 
>
> > Something like "Models aren't loaded yet. Are you missing django.setup() 
> in a standalone script?". 
>
>
> We’ve had this discussion before, cf. 
> 8121860be4b9379d107959290e5748bbaf6de1fe ;-) 
>
> The exception message could point to the “Troubleshooting” section of 
> docs/ref/applications.txt. We could extend the explanation of what 
> constitutes a “standalone script” — many devs won’t expect celery / rq to 
> fall in this category. 
>
> -- 
> Aymeric. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/94ea6214-fb51-455b-8421-6ce7bb18c2e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Improving MSSQL and Azure SQL support on Django

2016-01-26 Thread Cristiano Coelho
I'm interested in the progress of this as well :)

Sorry I didn't read through all the posts, mostly the first ones about the 
idea.

I would like to know, have you guys decided on which adapter to use? I have 
had a project where we needed to connect to SQL Server from a linux machine 
(actually amazon lambda) and even worse, we couldn't install any library 
with dependencies on C code, so we used one that was implemented in pure 
python that worked very well (pytds if I'm not wrong), with ofcourse, not 
the best performance.
Why do I tell this? Because even if you want django to run on SQL Server, 
it doesn't really mean you want to run it on a Windows machine, actually, 
that would probably be a terrible idea (no ofense), since apache works 
horribly bad on Windows, and Linux is atually the best OS to run a web 
server with python code (either nginx or apache). So please keep this in 
mind when chosing a connector, since if it has C dependencies (which it 
will probably have, since the pure python ones are quite slow).

About if you need different connectors for Azure or SQLServer, I'm 'almost' 
sure you don't, we use azure or other cloud based sqlserver deployments 
with no problem with standard sqlserver connectors.

So basically, do not aim this towards making django more Windows friendly, 
but rather the actual SQL Server backend.

El lunes, 25 de enero de 2016, 22:59:07 (UTC-3), Fabio Caritas Barrionuevo 
da Luz escribió:
>
> is there any update about the progress of this?
>
> -- 
> Fábio C. Barrionuevo da Luz
> Palmas - Tocantins - Brasil - América do Sul
>
>
>
> Em terça-feira, 13 de outubro de 2015 18:12:55 UTC-3, Tim Graham escreveu:
>>
>> If anyone is interested in listening in on the meetings with Microsoft 
>> engineers (Wednesday and Thursday 9am-5pm Pacific), let me know and I'll 
>> send you the Skype link.
>>
>> On Friday, October 2, 2015 at 11:53:17 AM UTC-7, Meet Bhagdev wrote:
>>>
>>>
>>>
>>> On Thursday, October 1, 2015 at 12:32:25 PM UTC-7, Tim Graham wrote:

 Hi Meet,

 I was wondering

 1. If you have any progress updates since your last message?

>>> 
>>>
>>> * Yes, engineers on my team I are currently ramping up on the three 
>>> Django-SQL Server adapters*
>>>
>>>
>>>- *  Django-pymssql*
>>>- * Django-pyodbc-azure*
>>>- 
>>> * Django-mssql *
>>>
>>> * The goal is to have a thorough understanding of what’s good and 
>>> what’s bad with these adapters before the event. *
>>>

 2. If you have any further details on the schedule for the time in 
 Seattle in a week and a half? (including video conference details for 
 those 
 unable to attend in person)

>>>
>>>- *We will have a video conference link for Day 2 and Day 3. 
>>>Participants interested can join the conference stream from their 
>>> browser. 
>>>The conference room mics are only capable to a certain extent. Thus the 
>>>quality might be a little poor. *
>>>
>>>
>>>- *We are finalizing the detailed schedule this week and will post 
>>>it on this thread by next Friday.  *
>>>
>>>
>>> 3. If myself or the other attendees should do anything to prepare for 
 the meetings?

 *Here are some things that you should prepare before coming to 
>>> Seattle.*
>>>
>>> *-*
>>>
>>>
>>>- 
>>> * Have a clear understanding of the things that you need from 
>>>Microsoft to improve the SQL Server support on Django. We have resources 
>>> to 
>>>do the heavy lifting but need guidance. *
>>>- * Share with us the issues we can help fix (on the Django side 
>>>and on the Django-ORM(database) side). *
>>>
>>>
>>> Thanks!

 On Thursday, September 17, 2015 at 3:38:09 PM UTC-4, Tim Allen wrote:
>
> Hey team, as promised, here are the simple tests I put together to 
> benchmark pyodbc vs pymssql. Be kind, this was Python I wrote a long time 
> ago!
>
> https://github.com/FlipperPA/pyodbc-pymssql-tests
>
> I've included example output on the README. Very basic, but useful.
>
> On Wednesday, September 16, 2015 at 11:27:59 AM UTC-4, Tim Allen wrote:
>>
>> Thanks for all of your efforts, Aymeric, I've been following your 
>> project since its inception - I'm FlipperPA on GitHub.
>>
>> On Sunday, September 13, 2015 at 4:59:34 AM UTC-4, Aymeric Augustin 
>> wrote:
>>>
>>> Did you mean “pyodbc outperforms pymssql”? Or did you go with pyodbc 
>>> despite lower performance? (Or did I misread that?)
>>>
>>
>> We went with pyodbc, despite lower performance. I've been meaning to 
>> put the simple tests up on GitHub - making a note to do that this week.
>>
>> At the time we were looking at options, we couldn't find a stable 
>> Django option for pymssql. I should have been more clear about the time 
>> frame in which we were testing as well; this was right around the time