[web2py] Re: Scheduler_Task Table Commit Issue (not Commiting) - Using queue_task and commit after

2018-02-23 Thread Fabrizzio Abogadoc
I'm using MySQL, I wasn't able to insert or queue in any way... but ...

I've managed to solve the issue in the next way: 

Using the queue_task method, if the task is inserted, returns ID, if are 
errors we can check the field and the msg returned. Debugging the msgs, 
I've inferred that NOW queue_task needs ALL params fields passed to 
succesfylly insert a Task.

FOR EXAMPLE:

task = scheduler.queue_task('request_source_task',
application_name=appname,
status="QUEUED",
task_name='request_source_task',
start_time=datetime.datetime.now() 
+ timedelta(seconds=30),
pargs=ids_request_source,
period=cinco_min,
repeats=1,  
retry_failed=3,  
timeout=treinta_min, 
sync_output=1
)
db_scheduler.commit()

ONLY considering all params, the queue_task inserted a record now... It's 
seems to be a bug...

(Meanwile another project in other server, after migration last week, had 
the same same issue)

-- 
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.


[web2py] Re: Scheduler_Task Table Commit Issue (not Commiting) - Using queue_task and commit after

2018-02-22 Thread Dave S


On Thursday, February 22, 2018 at 4:51:30 PM UTC-8, Fabrizzio Abogadoc 
wrote:
>
> I've migrated to a new server (AWS), 
> ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-20180201 
> (ami-a22323d8), 
>
> Last migration was around four months ago, everithing were ok, all the 
> configuration server, web2py, and code it's do it by ansible playbooks, so 
> there is "not possible some misconfiguration".
>
> Now, task creation inside task ( and task in general) are not working, not 
> created, I could issolate the issue to some commit problem with the 
> scheduler_task table.
>
> I've created some tests, for debuggin the server, I can insert in all 
> tables, but, when it comes scheduler_task table, I cannot commit.
>
>
What DBS are you using?

 

>
> Definition of Scheduler and Tasks in one Model:
>
> db_scheduler = DAL(path,
>pool_size=20,
>migrate=True,
>fake_migrate=False)
>
> tasks = dict()
> tasks['master_updates_task'] = master_updates_task
> tasks['master_abogadoc_task'] = master_abogadoc_task
>
> scheduler = Scheduler(db_scheduler, tasks=tasks, heartbeat=3)
>
> I have a controller from where I call to Test Insertion
>
> def insert_task():
> from datetime import date, time
> from abogadoc import utilitario
> import random
>
> dia = date.today()
> dia_str = dia.strftime('%Y-%m-%d')
> numero = random.randint(1, 1000)
> abogadoc_task_name = '%s_%s' % (dia_str, str(numero))
>
> start_time = utilitario.santiago_to_utc(hora=8)
> stop_time = utilitario.santiago_to_utc(hora=20)
>
> scheduler.queue_task('agendar_abogadoc',
>  task_name=abogadoc_task_name,
>  period=cuatro_horas,
>  timeout=treinta_min, repeats=0)
> scheduler.queue_task('master_abogadoc_task',
>  period=cinco_min,
>  timeout=una_hora, repeats=0)
> db_scheduler.commit()
>

That line was what I was going to suggest.  queue_task returns an ID, 
doesn't it?  Do those IDs show up in the table at all?

 

>
> Also I 've other function to insert in other table one register
>
> Locally, I don have problems, can insert in any table, and scheduler task, 
> but in the server, just can commit in any table but no in scheduler_task, 
> i've tried, different versions of web2py (2.14, locally and server), also 
> using different DBs one for code and other for scheduler, same behaviour
>
> I have the same version of Web2PY, 
> Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
> Server:
> Version 2.16.1-stable+timestamp.2017.11.13.23.50.07
>
> Maybe someone can give me any directon, i'm running out of ideas
>

Just to check the obvious, I think you're saying you can queue tasks when 
not inside a task.
There may be a table-level lock involved when you're inside a task.

/dps
 

-- 
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.