Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SteamOS Devkit Client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
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
devkit
SteamOS Devkit Client
Commits
bfecbf55
Commit
bfecbf55
authored
1 year ago
by
Timothee Besset
Browse files
Options
Downloads
Patches
Plain Diff
I prefer this implementation
parent
efc54773
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/devkit_client/__init__.py
+26
-27
26 additions, 27 deletions
client/devkit_client/__init__.py
with
26 additions
and
27 deletions
client/devkit_client/__init__.py
+
26
−
27
View file @
bfecbf55
...
...
@@ -1469,36 +1469,35 @@ def rgp_capture(args):
_simple_ssh
(
ssh
,
'
rm /tmp/*.rgp
'
,
silent
=
True
)
_simple_ssh
(
ssh
,
'
touch /tmp/rgp.trigger
'
,
silent
=
True
)
attempts
=
10
while
attempts
>
0
:
time
.
sleep
(.
1
)
attempts
-=
1
# Wait for completion by checking the RGP capture size.
filesize
=
0
while
True
:
out_text
,
err_text
,
exit_status
=
_simple_ssh
(
ssh
,
'
ls -1ts --block-size=1 /tmp/*.rgp
'
,
silent
=
True
)
if
exit_status
!=
0
:
break
;
new_filesize
=
out_text
.
split
(
'
'
)[
0
]
if
new_filesize
==
filesize
:
# RGP capture is complete.
break
;
filesize
=
new_filesize
time
.
sleep
(.
1
)
out_text
,
err_text
,
exit_status
=
_simple_ssh
(
ssh
,
'
ls -1t /tmp/*.rgp
'
,
silent
=
True
)
remote_filename
=
None
filename_wait
=
time
.
time
()
while
time
.
time
()
-
filename_wait
<
2
:
out_text
,
_
,
exit_status
=
_simple_ssh
(
ssh
,
'
ls -1t /tmp/*.rgp
'
,
silent
=
True
)
if
exit_status
==
0
:
remote_path
=
out_text
.
split
(
'
\n
'
)[
0
]
remote_filename
=
pathlib
.
PurePosixPath
(
remote_path
).
parts
[
-
1
]
os
.
makedirs
(
args
.
local_folder
,
exist_ok
=
True
)
local_path
=
os
.
path
.
join
(
args
.
local_folder
,
remote_filename
)
sftp
=
ssh
.
open_sftp
()
sftp
.
get
(
remote_path
,
local_path
)
logger
.
info
(
f
'
Downloaded to
{
local_path
}
'
)
break
if
attempts
<=
0
:
raise
Exception
(
'
Could not obtain a RGP capture: timeout. Have you enabled RGP capture in the Steam client, are you running a Vulkan title?
'
)
time
.
sleep
(.
1
)
if
exit_status
!=
0
:
raise
Exception
(
'
Timeout waiting for capture file. Have you enabled RGP capture in the Steam client, are you running a Vulkan title?
'
)
remote_path
=
out_text
.
split
(
'
\n
'
)[
0
]
remote_filename
=
pathlib
.
PurePosixPath
(
remote_path
).
parts
[
-
1
]
# wait for the full write by checking on the size
size
=
0
while
True
:
out_text
,
_
,
_
=
_simple_ssh
(
ssh
,
f
'
stat -c %s
{
remote_path
}
'
,
silent
=
True
,
check_status
=
True
)
updated_size
=
int
(
out_text
)
if
updated_size
!=
0
and
updated_size
==
size
:
break
size
=
updated_size
time
.
sleep
(.
5
)
# transfer
os
.
makedirs
(
args
.
local_folder
,
exist_ok
=
True
)
local_path
=
os
.
path
.
join
(
args
.
local_folder
,
remote_filename
)
sftp
=
ssh
.
open_sftp
()
sftp
.
get
(
remote_path
,
local_path
)
logger
.
info
(
f
'
Downloaded to
{
local_path
}
'
)
if
args
.
launch
:
if
not
os
.
path
.
exists
(
args
.
rgp_path
):
...
...
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