I am getting the following error when running a scheduler task with 
threading:

Traceback (most recent call last):   File 
"C:\Users\devteam\Desktop\web_apps\launchpad\production\web2py\gluon\scheduler.py",
 
line 298, in executor     functions = current._scheduler.tasks 
AttributeError: 'thread._local' object has no attribute '_scheduler' 

# THREAD FUNCTION TO SET ACCOUNT
def set_account( kwargs ):
   while not q.empty( ):
      entry = q.get( )
      kwargs[ 'db_con' ].db.account.update_or_insert( kwargs[ 'db_con' 
].db.account.ad_object_guid == entry[ 'ad_object_guid' ], **entry )

# CREATE SET AMOUNT OF THREADS
for i in range( num_of_threads ):
   key = 'Thread_{0}'.format( i )
   db_con[ key ] = Launchpad_DB( fake_migration = True, lazy_tables = True, 
is_worker = True )
   db_con[ key ].define_account( )
   threads[ key ] = LaunchpadThread( i, key, set_account, db_con = db_con[ key 
] )
   threads[ key ].start( )
# WAIT FOR ALL THREADS TO FINISH
for key in threads:
   threads[ key ].join( )


I am assuming the error is happening somewhere in there. I create a queue 
that holds all the accounts that are ready to be updated. I create a new 
DAL connection for each thread and pass that in.

Any idea why I would be getting the error that I am?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to