Running single cron based on the name

Hi,

I have a very heavy cron job schedule. I would like to run it on another single docker so that it won’t effect other cron job running.
May I know is there any statement or method to differentiate the cron job?

No you can not select which job the cron will run. Mainly because the user can register any task.

But instead of running the long job during the cron, maybe you could post it (or divide it) to the queue. There you can launch a pool of worker for a specific queue name.

Hi @ced,

Thank you for the fast respond.
My jobs is scheduling calling api to third party for getting the shipment out orders.
So, since it not trigger by User so it might not be able to call worker.

However, since you had mentioned the worker and using pool of worker.
I am very interested for this Idea.

are you able to give some hint or help for how to do that? it will be great
best regards,
Markus

Pretty strange that it is slow.
But by the way, why not trigger the call when the shipment is done for example. And have just a cron task that relaunch the task only for shipments who failed.

I do not see why. Any code can push to the queue: Task Queue — Tryton server

As you stated before, can launch the pool of workers to run the queue job.

How to specify the worker to run the “named” queue job?
Is it indicate at command cli?

$ trytond-worker --help
…
  --name NAME           work only on the named queue
…

Hi @ced ,

Sorry for late reply.
I implemented around 4 workers in dockers to run name service.
However, I get postgres error. like below. Is there an setting maximun connection?

I remenber in config has the setting max_db_conn. is it still valid?

File "bin/trytond-worker", line 26, in <module>
    worker.work(options)
  File "trytond/worker.py", line 59, in work
    queues = [Queue(pool, mpool) for pool in initializer(options, False)]
  File "trytond/worker.py", line 94, in initializer
    pool.init()
  File "trytond/pool.py", line 164, in init
    restart = not load_modules(
  File "trytond/modules/__init__.py", line 440, in load_modules
    with Transaction().new_transaction(), \
  File "trytond/transaction.py", line 225, in new_transaction
    return transaction.start(self.database.name, self.user,
  File "trytond/transaction.py", line 123, in start
    self.connection = database.get_connection(readonly=readonly,
  File "trytond/backend/postgresql/database.py", line 260, in get_connection
    conn = self._connpool.getconn()
  File "psycopg2/pool.py", line 169, in getconn
    return self._getconn(key)
  File "psycopg2/pool.py", line 93, in _getconn
    return self._connect(key)
  File "psycopg2/pool.py", line 63, in _connect
    conn = psycopg2.connect(*self._args, **self._kwargs)
  File "psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
OperationalError: FATAL:  sorry, too many clients already

It is set by

[database]
maxconn = 64

I filled Missing documentation for database timeout, minconn and maxconn (#11032) · Issues · Tryton / Tryton · GitLab