Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boinc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
einsteinathome
boinc
Commits
b781e409
Commit
b781e409
authored
10 years ago
by
Rom Walton
Browse files
Options
Downloads
Patches
Plain Diff
VBOX: Add support for intermediate uploads
parent
f81eda0f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
samples/vboxwrapper/vbox.h
+19
-0
19 additions, 0 deletions
samples/vboxwrapper/vbox.h
samples/vboxwrapper/vboxwrapper.cpp
+47
-0
47 additions, 0 deletions
samples/vboxwrapper/vboxwrapper.cpp
with
66 additions
and
0 deletions
samples/vboxwrapper/vbox.h
+
19
−
0
View file @
b781e409
...
@@ -54,6 +54,22 @@ struct VBOX_TIMESTAMP {
...
@@ -54,6 +54,22 @@ struct VBOX_TIMESTAMP {
int
milliseconds
;
int
milliseconds
;
};
};
// represents the state of a intermediate upload
struct
INTERMEDIATE_UPLOAD
{
std
::
string
file
;
bool
reported
;
bool
ignore
;
INTERMEDIATE_UPLOAD
()
{
clear
();
}
void
clear
()
{
file
=
""
;
reported
=
false
;
ignore
=
false
;
}
};
struct
PORT_FORWARD
{
struct
PORT_FORWARD
{
int
host_port
;
// 0 means assign dynamically
int
host_port
;
// 0 means assign dynamically
int
guest_port
;
int
guest_port
;
...
@@ -165,6 +181,8 @@ public:
...
@@ -165,6 +181,8 @@ public:
std
::
vector
<
std
::
string
>
trickle_trigger_files
;
std
::
vector
<
std
::
string
>
trickle_trigger_files
;
// if find file of this name in shared/, send trickle-up message
// if find file of this name in shared/, send trickle-up message
// with variety = filename, contents = file contents
// with variety = filename, contents = file contents
std
::
vector
<
INTERMEDIATE_UPLOAD
>
intermediate_upload_files
;
// if find file of this name in shared/, send specified file
std
::
string
completion_trigger_file
;
std
::
string
completion_trigger_file
;
// if find this file in shared/, task is over.
// if find this file in shared/, task is over.
// File can optionally contain exit code (first line)
// File can optionally contain exit code (first line)
...
@@ -207,6 +225,7 @@ public:
...
@@ -207,6 +225,7 @@ public:
int
pause
();
int
pause
();
int
resume
();
int
resume
();
void
check_trickle_triggers
();
void
check_trickle_triggers
();
void
check_intermediate_uploads
();
int
create_snapshot
(
double
elapsed_time
);
int
create_snapshot
(
double
elapsed_time
);
int
cleanup_snapshots
(
bool
delete_active
);
int
cleanup_snapshots
(
bool
delete_active
);
int
restore_snapshot
();
int
restore_snapshot
();
...
...
This diff is collapsed.
Click to expand it.
samples/vboxwrapper/vboxwrapper.cpp
+
47
−
0
View file @
b781e409
...
@@ -162,6 +162,7 @@ int VBOX_VM::parse_port_forward(XML_PARSER& xp) {
...
@@ -162,6 +162,7 @@ int VBOX_VM::parse_port_forward(XML_PARSER& xp) {
}
}
int
parse_job_file
(
VBOX_VM
&
vm
)
{
int
parse_job_file
(
VBOX_VM
&
vm
)
{
INTERMEDIATE_UPLOAD
iu
;
MIOFILE
mf
;
MIOFILE
mf
;
string
str
;
string
str
;
char
buf
[
1024
],
buf2
[
256
];
char
buf
[
1024
],
buf2
[
256
];
...
@@ -215,6 +216,12 @@ int parse_job_file(VBOX_VM& vm) {
...
@@ -215,6 +216,12 @@ int parse_job_file(VBOX_VM& vm) {
vm
.
trickle_trigger_files
.
push_back
(
str
);
vm
.
trickle_trigger_files
.
push_back
(
str
);
continue
;
continue
;
}
}
else
if
(
xp
.
parse_string
(
"intermediate_upload_file"
,
str
))
{
iu
.
clear
();
iu
.
file
=
str
;
vm
.
intermediate_upload_files
.
push_back
(
iu
);
continue
;
}
else
if
(
xp
.
parse_string
(
"completion_trigger_file"
,
str
))
{
else
if
(
xp
.
parse_string
(
"completion_trigger_file"
,
str
))
{
vm
.
completion_trigger_file
=
str
;
vm
.
completion_trigger_file
=
str
;
continue
;
continue
;
...
@@ -467,6 +474,45 @@ void VBOX_VM::check_trickle_triggers() {
...
@@ -467,6 +474,45 @@ void VBOX_VM::check_trickle_triggers() {
}
}
}
}
// check for intermediate upload files, and send them if found.
//
void
VBOX_VM
::
check_intermediate_uploads
()
{
int
retval
;
char
filename
[
256
],
path
[
MAXPATHLEN
],
buf
[
256
];
for
(
unsigned
int
i
=
0
;
i
<
intermediate_upload_files
.
size
();
i
++
)
{
strcpy
(
filename
,
intermediate_upload_files
[
i
].
file
.
c_str
());
sprintf
(
path
,
"shared/%s"
,
filename
);
if
(
!
boinc_file_exists
(
path
))
continue
;
if
(
!
intermediate_upload_files
[
i
].
reported
&&
!
intermediate_upload_files
[
i
].
ignore
)
{
fprintf
(
stderr
,
"%s Reporting an intermediate file. (%s)
\n
"
,
vboxwrapper_msg_prefix
(
buf
,
sizeof
(
buf
)),
intermediate_upload_files
[
i
].
file
.
c_str
()
);
retval
=
boinc_upload_file
(
intermediate_upload_files
[
i
].
file
);
if
(
retval
)
{
fprintf
(
stderr
,
"%s boinc_upload_file() failed: %s
\n
"
,
vboxwrapper_msg_prefix
(
buf
,
sizeof
(
buf
)),
boincerror
(
retval
)
);
intermediate_upload_files
[
i
].
ignore
=
true
;
}
else
{
intermediate_upload_files
[
i
].
reported
=
true
;
}
}
else
if
(
intermediate_upload_files
[
i
].
reported
&&
!
intermediate_upload_files
[
i
].
ignore
)
{
retval
=
boinc_upload_status
(
intermediate_upload_files
[
i
].
file
);
if
(
!
retval
)
{
fprintf
(
stderr
,
"%s Intermediate file uploaded. (%s)
\n
"
,
vboxwrapper_msg_prefix
(
buf
,
sizeof
(
buf
)),
intermediate_upload_files
[
i
].
file
.
c_str
()
);
intermediate_upload_files
[
i
].
ignore
=
true
;
}
}
}
}
// see if it's time to send trickle-up reporting elapsed time
// see if it's time to send trickle-up reporting elapsed time
//
//
void
check_trickle_period
()
{
void
check_trickle_period
()
{
...
@@ -1184,6 +1230,7 @@ int main(int argc, char** argv) {
...
@@ -1184,6 +1230,7 @@ int main(int argc, char** argv) {
if
((
loop_iteration
%
10
)
==
0
)
{
if
((
loop_iteration
%
10
)
==
0
)
{
current_cpu_time
=
starting_cpu_time
+
vm
.
get_vm_cpu_time
();
current_cpu_time
=
starting_cpu_time
+
vm
.
get_vm_cpu_time
();
vm
.
check_trickle_triggers
();
vm
.
check_trickle_triggers
();
vm
.
check_intermediate_uploads
();
}
}
if
(
vm
.
job_duration
)
{
if
(
vm
.
job_duration
)
{
...
...
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