Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scord
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
eu
ADMIRE
scord
Commits
199fe461
Verified
Commit
199fe461
authored
2 years ago
by
Alberto Miranda
Browse files
Options
Downloads
Patches
Plain Diff
Fix ADM_transfer_datasets C example
parent
fe27ccbb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!30
Resolve "Refactor library RPC implementation of `admire::transfer_dataset`"
Pipeline
#3122
passed
2 years ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/c/ADM_transfer_datasets.c
+11
-8
11 additions, 8 deletions
examples/c/ADM_transfer_datasets.c
examples/c/common.c
+35
-1
35 additions, 1 deletion
examples/c/common.c
examples/c/common.h
+6
-0
6 additions, 0 deletions
examples/c/common.h
with
52 additions
and
9 deletions
examples/c/ADM_transfer_datasets.c
+
11
−
8
View file @
199fe461
...
...
@@ -30,6 +30,9 @@
#define NINPUTS 10
#define NOUTPUTS 5
#define NSOURCES 5
#define NTARGETS 5
#define NLIMITS 3
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -68,17 +71,17 @@ main(int argc, char* argv[]) {
exit_status
=
EXIT_FAILURE
;
}
ADM_dataset_t
*
sources
=
NULL
;
size_t
sources_len
=
0
;
ADM_dataset_t
*
targets
=
NULL
;
size_t
targets_len
=
0
;
ADM_qos_limit_t
*
limits
=
NULL
;
size_t
limits_len
=
0
;
ADM_dataset_t
*
sources
=
prepare_datasets
(
"source-dataset-%d"
,
NSOURCES
)
;
assert
(
sources
)
;
ADM_dataset_t
*
targets
=
prepare_datasets
(
"target-dataset-%d"
,
NTARGETS
)
;
assert
(
targets
)
;
ADM_qos_limit_t
*
limits
=
prepare_qos_limits
(
NLIMITS
)
;
assert
(
limits
)
;
ADM_transfer_mapping_t
mapping
=
ADM_MAPPING_ONE_TO_ONE
;
ADM_transfer_t
tx
;
ret
=
ADM_transfer_datasets
(
server
,
job
,
sources
,
sources_len
,
targets
,
targets_len
,
limits
,
limits_len
,
mapping
,
&
tx
);
ret
=
ADM_transfer_datasets
(
server
,
job
,
sources
,
NSOURCES
,
targets
,
NTARGETS
,
limits
,
NLIMITS
,
mapping
,
&
tx
);
if
(
ret
!=
ADM_SUCCESS
)
{
fprintf
(
stdout
,
"ADM_transfer_datasets() remote procedure not "
...
...
This diff is collapsed.
Click to expand it.
examples/c/common.c
+
35
−
1
View file @
199fe461
...
...
@@ -15,11 +15,13 @@ prepare_datasets(const char* pattern, size_t n) {
}
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
// const char* pattern = "input-dataset-%d";
size_t
len
=
snprintf
(
NULL
,
0
,
pattern
,
i
);
char
*
id
=
(
char
*
)
alloca
(
len
+
1
);
snprintf
(
id
,
len
+
1
,
pattern
,
i
);
datasets
[
i
]
=
ADM_dataset_create
(
id
);
if
(
!
datasets
[
i
])
{
return
NULL
;
}
}
return
datasets
;
...
...
@@ -37,4 +39,36 @@ destroy_datasets(ADM_dataset_t datasets[], size_t n) {
free
(
datasets
);
}
ADM_qos_limit_t
*
prepare_qos_limits
(
size_t
n
)
{
ADM_qos_limit_t
*
limits
=
calloc
(
n
,
sizeof
(
ADM_qos_limit_t
));
if
(
!
limits
)
{
return
NULL
;
}
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
limits
[
i
]
=
ADM_qos_limit_create
(
NULL
,
ADM_QOS_CLASS_BANDWIDTH
,
50
);
if
(
!
limits
[
i
])
{
return
NULL
;
}
}
return
limits
;
}
void
destroy_qos_limits
(
ADM_qos_limit_t
*
limits
,
size_t
n
)
{
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
if
(
limits
[
i
])
{
ADM_qos_limit_destroy
(
limits
[
i
]);
}
}
free
(
limits
);
}
#endif // SCORD_COMMON_H
This diff is collapsed.
Click to expand it.
examples/c/common.h
+
6
−
0
View file @
199fe461
...
...
@@ -9,4 +9,10 @@ prepare_datasets(const char* pattern, size_t n);
void
destroy_datasets
(
ADM_dataset_t
datasets
[],
size_t
n
);
ADM_qos_limit_t
*
prepare_qos_limits
(
size_t
n
);
void
destroy_qos_limits
(
ADM_qos_limit_t
limits
[],
size_t
n
);
#endif // SCORD_C_EXAMPLES_COMMON_H
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