From c76078da8724a55a7dcb9df70a554cbf34b6b91f56db58029569d89248f4cb8f Mon Sep 17 00:00:00 2001 From: Vladislav Date: Thu, 23 Jul 2026 04:01:10 -0400 Subject: [PATCH] fix --- build.ipynb | 47 ++++++++++++++++++++++++++++++++--------------- tasks.ipynb | 8 ++++---- tasks.py | 8 ++++---- 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/build.ipynb b/build.ipynb index e79894b..b14f9b0 100644 --- a/build.ipynb +++ b/build.ipynb @@ -645,27 +645,13 @@ "outputs": [], "source": [ "!ssh kultmost 'systemctl restart production.service'\n", - "!ssh kultmost 'systemctl restart fastapi.service'" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a87971ac", - "metadata": { - "vscode": { - "languageId": "shellscript" - } - }, - "outputs": [], - "source": [ "!ssh kultmost 'systemctl status production.service'" ] }, { "cell_type": "code", "execution_count": null, - "id": "8714f4cc", + "id": "6fdc2d37", "metadata": { "vscode": { "languageId": "shellscript" @@ -673,6 +659,7 @@ }, "outputs": [], "source": [ + "!ssh kultmost 'systemctl restart fastapi.service'\n", "!ssh kultmost 'systemctl status fastapi.service'" ] }, @@ -684,6 +671,36 @@ "### restart celery" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "88961bb1", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [], + "source": [ + "%%bash\n", + "ssh kultmost 'tee /etc/systemd/system/vk-celery.service >/dev/null' <<'EOF'\n", + "[Unit]\n", + "Description=Celery VK\n", + "After=network.target\n", + "\n", + "[Service]\n", + "WorkingDirectory=/app/production\n", + "ExecStart=/app/production/.venv/bin/celery -A vk.celery_app_vk worker --loglevel=info\n", + "Restart=always\n", + "EnvironmentFile=/app/production/env\n", + "\n", + "[Install]\n", + "WantedBy=default.target\n", + "EOF\n", + "\n", + "ssh kultmost 'systemctl daemon-reload && systemctl enable --now vk-celery.service && systemctl status --no-pager -l vk-celery.service'\n" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/tasks.ipynb b/tasks.ipynb index 0650229..e806014 100644 --- a/tasks.ipynb +++ b/tasks.ipynb @@ -425,7 +425,7 @@ " query[\"$or\"].append({'service': True})\n", " query[\"$or\"].append({'user_id': exhibition['user']['_id']})\n", "\n", - " post_ref = {'_id': exhibition['_id'], 'db': 'exhibition', 'col': 'exhibition'}\n", + " post_ref = {'_id': str(exhibition['_id']), 'db': 'exhibition', 'col': 'exhibition'}\n", " medias = [exhibition.get(\"poster_orig_id\")]\n", "\n", " platforms = [\n", @@ -458,7 +458,7 @@ " print(f\"nospamsends:{exhibition['_id']}:{social['_id']}\")\n", " if already_sent:\n", " print(social)\n", - " client.notify.delay(post_ref, text, attachments, bson_clear(social), sign_avatar)" + " client.notify.delay(post_ref, text, attachments, bson_clear(social), False)" ] }, { @@ -479,7 +479,7 @@ " if usersSocial:\n", " query[\"$or\"].append({\"competition\": True})\n", " query[\"$or\"].append({\"competition\": {\"$exists\": False}})\n", - " post_ref = {'_id': competition['_id'], 'db': 'competitions', 'col': 'competitions'}\n", + " post_ref = {'_id': str(competition['_id']), 'db': 'competitions', 'col': 'competitions'}\n", " medias = [competition.get(\"poster_file_id\")]\n", "\n", " platforms = [\n", @@ -511,7 +511,7 @@ " print(f\"nospamsends:{competition['_id']}:{social['_id']}\")\n", " if already_sent:\n", " print(social)\n", - " client.notify.delay(post_ref, text, attachments, bson_clear(social), sign_avatar)" + " client.notify.delay(post_ref, text, attachments, bson_clear(social), False)" ] }, { diff --git a/tasks.py b/tasks.py index 68ce686..a7f1bdf 100644 --- a/tasks.py +++ b/tasks.py @@ -323,7 +323,7 @@ async def service_social_exhibition(exhibition): query["$or"].append({'service': True}) query["$or"].append({'user_id': exhibition['user']['_id']}) - post_ref = {'_id': exhibition['_id'], 'db': 'exhibition', 'col': 'exhibition'} + post_ref = {'_id': str(exhibition['_id']), 'db': 'exhibition', 'col': 'exhibition'} medias = [exhibition.get("poster_orig_id")] platforms = [ @@ -356,7 +356,7 @@ async def service_social_exhibition(exhibition): print(f"nospamsends:{exhibition['_id']}:{social['_id']}") if already_sent: print(social) - client.notify.delay(post_ref, text, attachments, bson_clear(social), sign_avatar) + client.notify.delay(post_ref, text, attachments, bson_clear(social), False) async def service_social_competition(competition, serviceSocial, userSocial, usersSocial): query = { 'active': True, "$or": []} @@ -369,7 +369,7 @@ async def service_social_competition(competition, serviceSocial, userSocial, use if usersSocial: query["$or"].append({"competition": True}) query["$or"].append({"competition": {"$exists": False}}) - post_ref = {'_id': competition['_id'], 'db': 'competitions', 'col': 'competitions'} + post_ref = {'_id': str(competition['_id']), 'db': 'competitions', 'col': 'competitions'} medias = [competition.get("poster_file_id")] platforms = [ @@ -401,7 +401,7 @@ async def service_social_competition(competition, serviceSocial, userSocial, use print(f"nospamsends:{competition['_id']}:{social['_id']}") if already_sent: print(social) - client.notify.delay(post_ref, text, attachments, bson_clear(social), sign_avatar) + client.notify.delay(post_ref, text, attachments, bson_clear(social), False) async def email_new_user(new_user): async for user in users_collection.find({'roles':'admin'}):