Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
AVVR-Pipeline-GDP4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GDP Project 4
AVVR-Pipeline-GDP4
Commits
a5244e4a
Commit
a5244e4a
authored
5 months ago
by
las1g21
Browse files
Options
Downloads
Patches
Plain Diff
Remote Completion
parent
c16ac615
No related branches found
No related tags found
1 merge request
!9
GDP 4.4.5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/scene_completion.py
+66
-12
66 additions, 12 deletions
scripts/scene_completion.py
with
66 additions
and
12 deletions
scripts/scene_completion.py
+
66
−
12
View file @
a5244e4a
...
...
@@ -3,6 +3,7 @@ from dotenv import load_dotenv
from
scp
import
SCPClient
import
os
import
subprocess
import
time
load_dotenv
()
hostname
=
os
.
getenv
(
"
HOSTNAME
"
)
...
...
@@ -10,6 +11,8 @@ username = os.getenv("USERNAME")
password
=
os
.
getenv
(
"
PASSWORD
"
)
def
send_files
(
shifted_disparity_path
,
shifted_t_path
):
# sends two files needed to iridis
# files keep their names. NAMES MUST BE shifted_disparity.png AND shifted_t.png
command
=
[
"
scp
"
,
...
...
@@ -44,25 +47,76 @@ def get_completed_scene(shifted_disparity_path, shifted_t_path):
client
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
# Connect to the server
client
.
connect
(
hostname
,
username
=
username
,
password
=
password
)
# Execute commands on the server
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
cd mona/MDBNet360_GDP/
"
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
module load conda
"
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
source activate
"
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
conda activate sscenv
"
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
cd mona/MDBNet360_GDP/sbatch --partition=ecsstudents --account=ecsstudents run_obj_job.sh
"
)
try
:
client
.
connect
(
hostname
,
username
=
username
,
password
=
password
)
print
(
"
SSH connection established.
"
)
# Check if the connection is active
if
client
.
get_transport
().
is_active
():
print
(
"
Connection is active.
"
)
else
:
print
(
"
Connection is not active.
"
)
exit
(
1
)
# Exit the script if the connection is not active
except
Exception
as
e
:
print
(
f
"
Failed to connect to
{
hostname
}
:
{
e
}
"
)
exit
(
1
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
cd mona/MDBNet360_GDP/
"
+
"
&& module load conda
"
+
"
&& source activate
"
+
"
&& conda activate ssc_env
"
+
"
&& sbatch --partition=ecsstudents --account=ecsstudents run_enhance360_job.sh
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
squeue -lu kproject
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
time
.
sleep
(
30
)
while
"
RUNNING
"
in
output
:
print
(
"
Sleeping for 30
"
)
time
.
sleep
(
30
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
squeue -lu kproject
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
# Print the output of the command
print
(
stdout
.
read
())
print
(
"
Finish Enhancing
"
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
cd mona/MDBNet360_GDP/ && ls
"
+
"
&& module load conda
"
+
"
&& source activate
"
+
"
&& conda activate ssc_env
"
+
"
&& sbatch --partition=ecsstudents --account=ecsstudents run_obj_job.sh
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
squeue -lu kproject
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
time
.
sleep
(
30
)
while
"
RUNNING
"
in
output
:
print
(
"
Sleeping for 30
"
)
time
.
sleep
(
30
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
squeue -lu kproject
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
print
(
"
CLOSING
"
)
# Close the SSH connection
client
.
close
()
return
True
else
:
return
False
out
=
send_files
(
"
C:
\\
Project
\\
AVVR-Pipeline-GDP4
\\
edgenet-360
\\
Data
\\
Listening
\\
shifted-disparity.png
"
,
"
C:
\\
Project
\\
AVVR-Pipeline-GDP4
\\
edgenet-360
\\
Data
\\
Listening
\\
shifted_t.png
"
)
out
=
get_completed_scene
(
"
C:
\\
Project
\\
AVVR-Pipeline-GDP4
\\
edgenet-360
\\
Data
\\
Courtyard
\\
shifted-disparity.png
"
,
"
C:
\\
Project
\\
AVVR-Pipeline-GDP4
\\
edgenet-360
\\
Data
\\
Courtyard
\\
shifted_t.png
"
)
print
(
out
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment