I have a recipe that used to work with previous prodigy version (1.9 something). It looks like this:
import prodigy
from playhouse.postgres_ext import PostgresqlExtDatabase
from prodigy.components.db import Database
from prodigy.recipes.generic import mark
import config
db = PostgresqlExtDatabase(**config.PRODIGY_DB)
prodigy_db = Database(db, "postgresql", "custom_pg")
@prodigy.recipe("vad",
dataset=('Dataset name to save annotations to', 'positional', None, str),
file_path=("Path to wav files", "positional", None, str)
)
def vad(dataset, file_path):
components = mark(dataset, file_path, label=config.task_labels, loader='audio-server', view_id='audio_manual')
components["db"] = prodigy_db
components["config"]["exclude_by"] = "input"
components["config"]["batch_size"] = config.batch_size
return components
We've just updated to prodigy 1.10.4, and this recipe now gives a AssertionError: RepeatingFeed requires a database connection.
error on /get_session_questions
.
I've seen a similar problem in another topic Losing samples on browser refresh, but there it seems to work sometimes (with force_stream
set to False
), while in my case it doesn't work at all.
I tried the solution @ines suggested in topic https://support.prodi.gy/t/losing-samples-on-browser-refresh/3450/4:
from prodigy.util import registry
db = PostgresqlExtDatabase(...) # etc.
registry.databases("custom_postgres", func=db)
but it results in another error:
Traceback (most recent call last):
File "/../../.pyenv/versions/3.7.3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/../../.pyenv/versions/3.7.3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/../../.pyenv/versions/prodigy/lib/python3.7/site-packages/prodigy/__main__.py", line 60, in <module>
controller = recipe(*args, use_plac=True)
File "cython_src/prodigy/core.pyx", line 327, in prodigy.core.recipe.recipe_decorator.recipe_proxy
File "cython_src/prodigy/core.pyx", line 116, in prodigy.core.Controller.__init__
File "cython_src/prodigy/core.pyx", line 285, in prodigy.core.Controller.connect_db
TypeError: argument of type 'PostgresqlExtDatabase' is not iterable