| """ |
| Update this script and run it inside the worker container to run your product predictions via script |
| """ |
| print("Setting up product prediction...") |
|
|
| |
| from celery import Celery |
| from utils import wait_for_result |
|
|
| |
| celery_app = Celery() |
| print("Broker:", celery_app.conf.broker_url) |
| print("Backend:", celery_app.conf.result_backend) |
|
|
| |
| reactants_list = ["CCI.O=Cc1ccc([N+](=O)[O-])c(O)c1", "CCOc1cc(O)c(C=O)cc1OCC.OCCCBr", "C=CCc1cc(OCc2ccccc2)ccc1O.CCBr"] |
|
|
| |
| kwargs = { |
| "topn": 1, |
| "num_beams": 3, |
| "device": None, |
| "ckpt_forward": "Pistachio2025Q2-Forward", |
| "vocab": "Pistachio2025Q2", |
| |
| |
| } |
|
|
| |
| task = celery_app.send_task( |
| "tasks.product_prediction", |
| [reactants_list], |
| kwargs=kwargs, |
| queue="product_prediction", |
| ) |
| print("Task sent. Assigned task_id: {}".format(task.id)) |
|
|
| |
| wait_for_result(celery_app, task.id, timeout=180) |
|
|