Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/sync with backend #98

Merged
merged 46 commits into from
Dec 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
4c12044
feat: Version each of bot & df_designer dirs
Ramimashkouk Jun 7, 2024
5fc58c5
Merge branch 'dev' into feat/version-user-proj2
Ramimashkouk Aug 8, 2024
683f5f6
style: Black up
Ramimashkouk Aug 8, 2024
7ffb675
fix: Delete is_alive & slot interface
Ramimashkouk Oct 4, 2024
2c4a105
fix: Run python3 if python wasn't found
Ramimashkouk Oct 8, 2024
ca9c92f
refactor: Reorganize json_converter into classes
Ramimashkouk Oct 11, 2024
0b888b5
refactor: Add store_custom_services
Ramimashkouk Oct 11, 2024
dd4f67c
Merge branch 'fix/slots' into test/fix-tests
Ramimashkouk Oct 28, 2024
8aa4bd8
test: Add tests for new json_converter
Ramimashkouk Nov 2, 2024
43e3ff6
fix: Handle building if there's no slot_node in graph
Ramimashkouk Nov 5, 2024
c75b014
refactor: Add dev group in toml file
Ramimashkouk Nov 5, 2024
6727a18
refactor: Use ast instead of the manual old indexing
Ramimashkouk Nov 5, 2024
39f97f6
chore: Update to the new template repo
Ramimashkouk Nov 5, 2024
cc78f17
Merge branch 'feat/version-user-proj2' into refactor/roma-feedback
Ramimashkouk Nov 8, 2024
c437449
chore: Add logging to show weather it's gonna build
Ramimashkouk Nov 8, 2024
7433d33
fix: Save tg_token in .env
Ramimashkouk Nov 8, 2024
af4dab2
feat: Support automatic transitions (previous, ...)
Ramimashkouk Nov 8, 2024
42b8af1
style: Black up
Ramimashkouk Nov 8, 2024
be81934
style: Flake8 up
Ramimashkouk Nov 8, 2024
30f38c6
fix: Check for unique group names
Ramimashkouk Nov 14, 2024
463a746
feat: Integrate slots in responses by FillTemplate
Ramimashkouk Nov 14, 2024
53ea889
feat: Delete websocket and use http_interface
Ramimashkouk Nov 19, 2024
0a84d80
fix: Get last flow not last tag with `/flows`
Ramimashkouk Nov 19, 2024
6a5ef9a
chore: Write logs out in case of stopped process
Ramimashkouk Nov 20, 2024
31d1ef9
test: Fix json-converter tests
Ramimashkouk Nov 20, 2024
ca7b301
fix: Check aliveness of a tg|http process properly
Ramimashkouk Nov 27, 2024
1767b4f
fix: Version with git only when using UI
Ramimashkouk Nov 28, 2024
ba5b4a9
fix: Save built script after end of process
Ramimashkouk Nov 29, 2024
b62d9dd
fix: Return http health checking
Ramimashkouk Nov 29, 2024
11b5101
fix: Set a logger for service_replacer
Ramimashkouk Nov 29, 2024
c434d36
chore: Clean old config refreshing
Ramimashkouk Nov 29, 2024
221a2ff
fix: Save script in periodic-check& separate is_alive
Ramimashkouk Nov 29, 2024
077e758
fix: Return config reload refreshing feature
Ramimashkouk Nov 29, 2024
c1f3696
fix: Terminate a group process with its children
Ramimashkouk Dec 2, 2024
50eb381
websocket removed
artem-mar Dec 2, 2024
afb79a8
fix: Get env vars after reloading if any
Ramimashkouk Dec 2, 2024
b8e9eba
fix responses and conditions
artem-mar Dec 2, 2024
e5aedc3
token sending added
artem-mar Dec 2, 2024
7c1a12c
rename repeat to current
artem-mar Dec 2, 2024
0ac2dd4
Merge branch 'test/fix-tests-up' into fix/sync-with-backend
artem-mar Dec 2, 2024
9491d2b
chore: update dependencies
artem-mar Dec 3, 2024
dc29529
fix: fixed chat functionality
artem-mar Dec 3, 2024
3fd9580
Merge branch 'dev' into fix/sync-with-backend
Ramimashkouk Dec 16, 2024
219345a
update lock file
Ramimashkouk Dec 16, 2024
c130be1
Merge branch 'dev' into fix/sync-with-backend
Ramimashkouk Dec 16, 2024
372d79d
style: Black up
Ramimashkouk Dec 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Save built script after end of process
  • Loading branch information
Ramimashkouk committed Nov 29, 2024
commit ba5b4a97405df4dd6674a47934975d2bd4499bb1
34 changes: 23 additions & 11 deletions backend/chatsky_ui/services/process.py
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@
from chatsky_ui.core.logger_config import get_logger, setup_logging
from chatsky_ui.db.base import read_conf, write_conf
from chatsky_ui.schemas.process_status import Status
from chatsky_ui.utils.git_cmd import get_repo, save_frontend_graph_to_git, save_built_script_to_git


load_dotenv()

@@ -173,17 +175,17 @@ async def check_telegram_readiness(stream, name):
return True
return False

async with AsyncClient() as client:
try:
response = await client.get(
f"http://localhost:{HTTP_INTERFACE_PORT}/health",
)
return response.json()["status"] == "ok"
except Exception as e:
self.logger.info(
f"Process '{self.id}' isn't alive on port '{HTTP_INTERFACE_PORT}'. "
f"Ignore this if you're not connecting via HTTPInterface. Exception caught: {e}"
)
# async with AsyncClient() as client:
# try:
# response = await client.get(
# f"http://localhost:{HTTP_INTERFACE_PORT}/health",
# )
# return response.json()["status"] == "ok"
# except Exception as e:
# self.logger.info(
# f"Process '{self.id}' isn't alive on port '{HTTP_INTERFACE_PORT}'. "
# f"Ignore this if you're not connecting via HTTPInterface. Exception caught: {e}"
# )

done, pending = await asyncio.wait(
[
@@ -273,3 +275,13 @@ async def update_db_info(self) -> None:
builds_conf = self.add_new_conf(builds_conf, build_params) # type: ignore

await write_conf(builds_conf, settings.builds_path)

def save_built_script_to_git(self, id_: int) -> None:
bot_repo = get_repo(settings.custom_dir.parent)
save_built_script_to_git(id_, bot_repo)

async def check_status(self) -> Status:
status = await super().check_status()
if status not in [Status.NULL, Status.RUNNING, Status.ALIVE]:
# Save the project anyway to keep a gradual number of builds
self.save_built_script_to_git(self.id)
9 changes: 1 addition & 8 deletions backend/chatsky_ui/services/process_manager.py
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
from chatsky_ui.schemas.preset import Preset
from chatsky_ui.schemas.process_status import Status
from chatsky_ui.services.process import BuildProcess, RunProcess
from chatsky_ui.utils.git_cmd import get_repo, save_frontend_graph_to_git, save_built_script_to_git
from chatsky_ui.utils.git_cmd import get_repo, save_frontend_graph_to_git


class ProcessManager:
@@ -190,9 +190,6 @@ async def start(self, preset: Preset) -> int:
await process.start(cmd_to_run)
self.processes[id_] = process

# Save the project anyway to keep a gradual number of builds
self.save_built_script_to_git(id_)

return self.last_id

async def check_status(self, id_, *args, **kwargs):
@@ -221,10 +218,6 @@ def is_changed_graph(self, id_: int) -> bool:
self.logger.info("Graph isn't changed. Ain't gonna build")
return False

def save_built_script_to_git(self, id_: int) -> None:
bot_repo = get_repo(settings.custom_dir.parent)
save_built_script_to_git(id_, bot_repo)

async def get_build_info(self, id_: int, run_manager: RunManager) -> Optional[Dict[str, Any]]:
"""Returns metadata of a specific build process identified by its unique ID.

Loading