Skip to content

Commit

Permalink
Added profile to Copy Offload API
Browse files Browse the repository at this point in the history
`DataMovementCreateRequest`can now specify a server-side DM profile via
the `profile` parameter.

If empty, it will use the `default` profile.

Signed-off-by: Blake Devcich <[email protected]>
  • Loading branch information
bdevcich committed Nov 21, 2023
1 parent 88dbb1b commit 588e8ed
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 180 deletions.
6 changes: 6 additions & 0 deletions daemons/compute/api/datamovement.proto
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ message DataMovementCreateRequest {
// The number of max_slots specified in the MPI hostfile. A value of 0 disables the use of
// max_slots in the hostfile. -1 will defer to the server side configuration.
int32 maxSlots = 9;

// The name of the data movement configuration profile to use. The above parameters (e.g. slots,
// logStdout) will override the settings defined by the profile. This profile must exist on the
// server otherwise the data movement operation will be invalid. Empty will default to the
// default profile.
string profile = 10;
}

// The Data Movement Create Response to indicate the status of of the Data Movement Request.
Expand Down
293 changes: 153 additions & 140 deletions daemons/compute/client-go/api/datamovement.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion daemons/compute/client-go/api/datamovement_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions daemons/compute/client-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func main() {
namespace := flag.String("namespace", os.Getenv("DW_WORKFLOW_NAMESPACE"), "parent workflow namespace")
source := flag.String("source", "", "source file or directory")
destination := flag.String("destination", "", "destination file or directory")
dryrun := flag.Bool("dryrun", false, "perfrom dry run of operation")
dryrun := flag.Bool("dryrun", false, "perform dry run of operation")
skipDelete := flag.Bool("skip-delete", false, "skip deleting the resource after completion")
socket := flag.String("socket", "/var/run/nnf-dm.sock", "socket address")
maxWaitTime := flag.Int64("max-wait-time", 0, "maximum time to wait for status completion, in seconds.")
Expand All @@ -51,6 +51,7 @@ func main() {
storeStdout := flag.Bool("store-stdout", false, "store stdout in status message on successful dm")
slots := flag.Int("slots", -1, "slots to use in mpirun hostfile. -1 defers to system config, 0 omits from hostfile")
maxSlots := flag.Int("max-slots", -1, "max_slots to use in mpirun hostfile. -1 defers to system config, 0 omits from hostfile")
profile := flag.String("profile", "", "which data movement profile to use on the server, empty defaults to default profile")

flag.Parse()

Expand Down Expand Up @@ -99,7 +100,10 @@ func main() {
defer wg.Done()

log.Printf("Creating request %d of %d...", i+1, *count)
createResponse, err := createRequest(ctx, c, *workflow, *namespace, *source, *destination, *dryrun, *dcpOptions, *logStdout, *storeStdout, *slots, *maxSlots)
createResponse, err := createRequest(ctx, c, *workflow, *namespace,
*source, *destination, *dryrun, *dcpOptions,
*logStdout, *storeStdout, *slots, *maxSlots,
*profile)
if err != nil {
log.Fatalf("could not create data movement request: %v", err)
}
Expand Down Expand Up @@ -212,7 +216,7 @@ func versionRequest(ctx context.Context, client pb.DataMoverClient) (*pb.DataMov

func createRequest(ctx context.Context, client pb.DataMoverClient, workflow, namespace,
source, destination string, dryrun bool, dcpOptions string, logStdout, storeStdout bool,
slots, maxSlots int) (*pb.DataMovementCreateResponse, error) {
slots, maxSlots int, profile string) (*pb.DataMovementCreateResponse, error) {

rsp, err := client.Create(ctx, &pb.DataMovementCreateRequest{
Workflow: &pb.DataMovementWorkflow{
Expand All @@ -227,6 +231,7 @@ func createRequest(ctx context.Context, client pb.DataMoverClient, workflow, nam
StoreStdout: storeStdout,
Slots: int32(slots),
MaxSlots: int32(maxSlots),
Profile: profile,
})

if err != nil {
Expand Down
65 changes: 32 additions & 33 deletions daemons/compute/client-py/datamovement_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions daemons/compute/copy-offload-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,16 @@ <h3 id="datamovement.DataMovementCreateRequest">DataMovementCreateRequest</h3>
max_slots in the hostfile. -1 will defer to the server side configuration. </p></td>
</tr>

<tr>
<td>profile</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p>The name of the data movement configuration profile to use. The above parameters (e.g. slots,
logStdout) will override the settings defined by the profile. This profile must exist on the
server otherwise the data movement operation will be invalid. Empty will default to the
default profile. </p></td>
</tr>

</tbody>
</table>

Expand Down
3 changes: 2 additions & 1 deletion daemons/compute/lib-cpp/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ std::vector<std::string> VersionResponse::apiversions() {
return apiVersions;
}

CreateRequest::CreateRequest(std::string source, std::string destination, bool dryrun, std::string dcpOptions, bool logStdout, bool storeStdout, int slots, int maxSlots) {
CreateRequest::CreateRequest(std::string source, std::string destination, bool dryrun, std::string dcpOptions, bool logStdout, bool storeStdout, int slots, int maxSlots, std::string profile) {
auto request = new datamovement::DataMovementCreateRequest();

request->set_source(source);
Expand All @@ -213,6 +213,7 @@ CreateRequest::CreateRequest(std::string source, std::string destination, bool d
request->set_storestdout(storeStdout);
request->set_slots(slots);
request->set_maxslots(maxSlots);
request->set_profile(profile);

data_ = static_cast<void *>(request);
}
Expand Down
2 changes: 1 addition & 1 deletion daemons/compute/lib-cpp/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class CommandStatus {

class CreateRequest {
public:
CreateRequest(std::string source, std::string destination, bool dryrun, std::string dcpOptions, bool logStdout, bool storeStdout, int slots, int maxSlots);
CreateRequest(std::string source, std::string destination, bool dryrun, std::string dcpOptions, bool logStdout, bool storeStdout, int slots, int maxSlots, std::string profile);
~CreateRequest();

private:
Expand Down
2 changes: 1 addition & 1 deletion daemons/compute/lib-cpp/example/client-example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main(int argc, char** argv) {

{
// Create an offload request
CreateRequest createRequest("YOUR-SOURCE", "YOUR-DESTINATION", false, "", false, false, -1, -1);
CreateRequest createRequest("YOUR-SOURCE", "YOUR-DESTINATION", false, "", false, false, -1, -1, "");
CreateResponse createResponse;

RPCStatus status = client.Create(workflow, createRequest, &createResponse);
Expand Down
2 changes: 2 additions & 0 deletions daemons/compute/server/servers/server_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ func (s *defaultServer) createNnfDataMovement(ctx context.Context, req *pb.DataM
Name: lustrefs.Name,
},
},
Profile: req.Profile,
},
}

Expand Down Expand Up @@ -465,6 +466,7 @@ func (s *defaultServer) createNnfNodeDataMovement(ctx context.Context, req *pb.D
Destination: &nnfv1alpha1.NnfDataMovementSpecSourceDestination{
Path: req.Destination,
},
Profile: req.Profile,
},
}

Expand Down

0 comments on commit 588e8ed

Please sign in to comment.