Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
V
vidai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SexHackMe
vidai
Commits
5b39ec90
Commit
5b39ec90
authored
Oct 09, 2025
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make all debug prints conditional on get_debug() - suppress debug output when --debug not specified
parent
e6634929
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
36 deletions
+68
-36
worker_analysis.py
vidai/worker_analysis.py
+50
-26
worker_training.py
vidai/worker_training.py
+18
-10
No files found.
vidai/worker_analysis.py
View file @
5b39ec90
This diff is collapsed.
Click to expand it.
vidai/worker_training.py
View file @
5b39ec90
...
@@ -27,11 +27,12 @@ import shutil
...
@@ -27,11 +27,12 @@ import shutil
import
json
import
json
import
time
import
time
from
.comm
import
SocketCommunicator
,
Message
from
.comm
import
SocketCommunicator
,
Message
from
.config
import
get_comm_type
,
get_backend_worker_port
from
.config
import
get_comm_type
,
get_backend_worker_port
,
get_debug
def
train_model
(
train_path
,
output_model
,
description
):
def
train_model
(
train_path
,
output_model
,
description
):
"""Perform training."""
"""Perform training."""
print
(
f
"DEBUG: Starting training with videotrain for output_model {output_model}"
)
if
get_debug
():
print
(
f
"DEBUG: Starting training with videotrain for output_model {output_model}"
)
desc_file
=
os
.
path
.
join
(
train_path
,
"description.txt"
)
desc_file
=
os
.
path
.
join
(
train_path
,
"description.txt"
)
with
open
(
desc_file
,
"w"
)
as
f
:
with
open
(
desc_file
,
"w"
)
as
f
:
f
.
write
(
description
)
f
.
write
(
description
)
...
@@ -39,7 +40,8 @@ def train_model(train_path, output_model, description):
...
@@ -39,7 +40,8 @@ def train_model(train_path, output_model, description):
# Assume videotrain is available
# Assume videotrain is available
cmd
=
[
"python"
,
"videotrain"
,
train_path
,
"--output_dir"
,
output_model
]
cmd
=
[
"python"
,
"videotrain"
,
train_path
,
"--output_dir"
,
output_model
]
result
=
subprocess
.
run
(
cmd
,
capture_output
=
True
,
text
=
True
)
result
=
subprocess
.
run
(
cmd
,
capture_output
=
True
,
text
=
True
)
print
(
f
"DEBUG: Training subprocess completed with returncode {result.returncode}"
)
if
get_debug
():
print
(
f
"DEBUG: Training subprocess completed with returncode {result.returncode}"
)
if
result
.
returncode
==
0
:
if
result
.
returncode
==
0
:
return
"Training completed!"
return
"Training completed!"
else
:
else
:
...
@@ -47,7 +49,8 @@ def train_model(train_path, output_model, description):
...
@@ -47,7 +49,8 @@ def train_model(train_path, output_model, description):
def
worker_process
(
backend_type
:
str
):
def
worker_process
(
backend_type
:
str
):
"""Main worker process."""
"""Main worker process."""
print
(
f
"Starting Training Worker for {backend_type}..."
)
if
get_debug
():
print
(
f
"Starting Training Worker for {backend_type}..."
)
# Workers use TCP for interprocess communication
# Workers use TCP for interprocess communication
comm
=
SocketCommunicator
(
host
=
'127.0.0.1'
,
port
=
get_backend_worker_port
(),
comm_type
=
'tcp'
)
comm
=
SocketCommunicator
(
host
=
'127.0.0.1'
,
port
=
get_backend_worker_port
(),
comm_type
=
'tcp'
)
...
@@ -60,10 +63,11 @@ def worker_process(backend_type: str):
...
@@ -60,10 +63,11 @@ def worker_process(backend_type: str):
while
True
:
while
True
:
try
:
try
:
message
=
comm
.
receive_message
()
message
=
comm
.
receive_message
()
if
message
:
if
message
and
get_debug
()
:
print
(
f
"DEBUG: Worker {os.getpid()} received message: {message}"
)
print
(
f
"DEBUG: Worker {os.getpid()} received message: {message}"
)
if
message
and
message
.
msg_type
==
'train_request'
:
if
message
and
message
.
msg_type
==
'train_request'
:
print
(
f
"DEBUG: Worker received train_request: {message.msg_id}"
)
if
get_debug
():
print
(
f
"DEBUG: Worker received train_request: {message.msg_id}"
)
data
=
message
.
data
data
=
message
.
data
output_model
=
data
.
get
(
'output_model'
,
'./VideoModel'
)
output_model
=
data
.
get
(
'output_model'
,
'./VideoModel'
)
description
=
data
.
get
(
'description'
,
''
)
description
=
data
.
get
(
'description'
,
''
)
...
@@ -71,16 +75,20 @@ def worker_process(backend_type: str):
...
@@ -71,16 +75,20 @@ def worker_process(backend_type: str):
if
train_dir
and
os
.
path
.
isdir
(
train_dir
):
if
train_dir
and
os
.
path
.
isdir
(
train_dir
):
print
(
f
"PROGRESS: Job {message.msg_id} accepted - Starting training"
)
print
(
f
"PROGRESS: Job {message.msg_id} accepted - Starting training"
)
print
(
f
"DEBUG: Starting training for job {message.msg_id}"
)
if
get_debug
():
print
(
f
"DEBUG: Starting training for job {message.msg_id}"
)
result
=
train_model
(
train_dir
,
output_model
,
description
)
result
=
train_model
(
train_dir
,
output_model
,
description
)
print
(
f
"PROGRESS: Job {message.msg_id} - 100
% -
Training completed"
)
print
(
f
"PROGRESS: Job {message.msg_id} - 100
% -
Training completed"
)
print
(
f
"DEBUG: Training completed for job {message.msg_id}"
)
if
get_debug
():
print
(
f
"DEBUG: Training completed for job {message.msg_id}"
)
else
:
else
:
result
=
"No valid training directory provided"
result
=
"No valid training directory provided"
print
(
f
"DEBUG: No valid training directory for job {message.msg_id}"
)
if
get_debug
():
print
(
f
"DEBUG: No valid training directory for job {message.msg_id}"
)
response
=
Message
(
'train_response'
,
message
.
msg_id
,
{
'message'
:
result
})
response
=
Message
(
'train_response'
,
message
.
msg_id
,
{
'message'
:
result
})
print
(
f
"DEBUG: Sending train_response for job {message.msg_id}"
)
if
get_debug
():
print
(
f
"DEBUG: Sending train_response for job {message.msg_id}"
)
comm
.
send_message
(
response
)
comm
.
send_message
(
response
)
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
except
Exception
as
e
:
except
Exception
as
e
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment