Commit 541ffb18 authored by Claudio Cacciari's avatar Claudio Cacciari
Browse files

updated the examples of rules to reflect the last changes

parent 543ce999
......@@ -166,8 +166,8 @@ EUDATTransferUsingFailLog(*buffer_length, *stats) {
*success_counter = 0;
*failure_counter = 0;
#TODO add these parameters to the fail log messages
*registered = bool("true");
*recursive = bool("true");
*registered = "true";
*recursive = "true";
# get size of queue-log before transfer.
EUDATQueue("queuesize", *l, 0);
......
eudatCHMC{
# Walk through the collection. For each object in the collection
# create a PID and stores its value and the object checksum
# in the iCAT if it does not exist.
# IF the PID exists, modify its checksum value
EUDATeiPIDeiChecksumMgmtColl(*sourceColl);
}
INPUT *sourceColl='/vzRZGEUDAT/home/eudat/11'
OUTPUT ruleExecOut
eudatRepl{
writeLine("stdout", "userNameClient: $userNameClient");
writeLine("stdout", "rodsZoneClient: $rodsZoneClient");
if (*home == '') {
*home="/$rodsZoneClient/home/$userNameClient";
}
msiDataObjCreate("*home/test_data.txt", "", *fd);
msiDataObjWrite(*fd, "Hello World!", "");
msiDataObjClose(*fd, *status1);
writeLine("stdout", "Object *home/test_data.txt written with success!");
writeLine("stdout", "Its content is: Hello World!");
# PID creation
# with PID registration in iCAT (4th argument "true")
# EUDATCreatePID(*parent_pid, *source, *ror, "true", *newPID);
EUDATCreatePID("None", "*home/test_data.txt", "None", "true", *newPID);
writeLine("stdout", "The Object *home/test_data.txt has PID = *newPID");
EUDATePIDremove("*home/test_data.txt", "true");
writeLine("stdout", "PID *newPID removed");
msiDataObjUnlink("*home/test_data.txt",*status2);
writeLine("stdout", "Object *home/test_data.txt removed");
}
INPUT *home=''
OUTPUT ruleExecOut
eudatIC{
# Compare cheksums of data objects in the source and destination
# collection recursively
EUDATCheckIntegrityColl(*source, *destination, bool("true"), *response)
}
INPUT *source='/vzRZGEUDAT/home/eudat/11', *destination='/devRZG/home/eudat#vzRZGEUDAT/11-6'
OUTPUT ruleExecOut
eudatPidsColl{
# Create PIDs for all collections and objects in the collection recursively
# ROR is assumed to be "None"
EUDATPidsForColl(*coll_path);
}
INPUT *coll_path='/vzRZGEUDAT/home/eudat/11'
OUTPUT *newPID,ruleExecOut
eudatRepl{
# Data set replication
# registered data (with PID registration) (3rd argument - 1st bool("true"))
# recursive (4th argument 2nd bool("true"))
EUDATReplication(*source, *destination, bool("true"), bool("true"), *response)
}
INPUT *source='/vzRZGEUDAT/home/eudat/11', *destination='/devRZG/home/eudat#vzRZGEUDAT/11-6'
OUTPUT ruleExecOut
eudatRepl{
writeLine("stdout", "userNameClient: $userNameClient");
writeLine("stdout", "rodsZoneClient: $rodsZoneClient");
if (*home == '') {
*home="/$rodsZoneClient/home/$userNameClient";
}
msiDataObjCreate("*home/test_data.txt", "", *fd);
msiDataObjWrite(*fd, "Hello World!", "");
msiDataObjClose(*fd, *status1);
writeLine("stdout", "Object *home/test_data.txt written with success!");
writeLine("stdout", "Its content is: Hello World!");
# PID creation
# with PID registration in iCAT (4th argument "true")
# EUDATCreatePID(*parent_pid, *source, *ror, "true", *newPID);
EUDATCreatePID("None", "*home/test_data.txt", "None", "true", *newPID);
writeLine("stdout", "The Object *home/test_data.txt has PID = *newPID");
# Data set replication
# with PID registration (3rd argument "true")
# and not recursive (4th argument "false")
*res = EUDATReplication("*home/test_data.txt", "*home/test_data2.txt", "true", "false", *response);
if (*res) {
writeLine("stdout", "Object *home/test_data.txt replicated to Object *home/test_data2.txt!");
writeLine("stdout", "The content of the replica is:");
msiDataObjOpen("*home/test_data2.txt", *S_FD);
msiDataObjRead(*S_FD, 12,*R_BUF);
writeBytesBuf("stdout", *R_BUF);
msiDataObjClose(*S_FD, *status2);
writeLine("stdout", "");
EUDATiFieldVALUEretrieve("*home/test_data2.txt", "PID", *value);
writeLine("stdout", "The Replica *home/test_data2.txt has PID = *value");
# Data set integrity check
# with logging enabled (3rd argument "true")
# EUDATCheckIntegrityDO(*source, *destination, *logEnabled, *response);
*status_check = EUDATCheckIntegrityDO("*home/test_data.txt", "*home/test_data2.txt", bool("true"), *response);
if (*status_check) {
writeLine("stdout", "Integrity check after replication: successful!");
}
else {
writeLine("stdout", "Integrity check after replication: failed: *response");
}
EUDATePIDremove("*home/test_data2.txt", "true");
writeLine("stdout", "PID *value removed");
msiDataObjUnlink("*home/test_data2.txt",*status3);
writeLine("stdout", "Replica removed");
}
else {
writeLine("stdout", "Replication failed: *response");
}
EUDATePIDremove("*home/test_data.txt", "true");
writeLine("stdout", "PID *newPID removed");
msiDataObjUnlink("*home/test_data.txt",*status4);
writeLine("stdout", "Object *home/test_data.txt removed");
}
INPUT *home=''
OUTPUT ruleExecOut
eudatRepl{
writeLine("stdout", "userNameClient: $userNameClient");
writeLine("stdout", "rodsZoneClient: $rodsZoneClient");
if (*home == '') {
*home="/$rodsZoneClient/home/$userNameClient";
}
*tcoll="*home/test_coll";
msiCollCreate(*tcoll, "0", *status0);
writeLine("stdout","Created collection *home/test_coll");
*tdata="*tcoll/test_data.txt";
msiDataObjCreate(*tdata, "", *fd);
msiDataObjWrite(*fd, "Hello World!", "");
msiDataObjClose(*fd, *status1);
writeLine("stdout", "Object *tdata written with success!");
writeLine("stdout", "Its content is: Hello World!");
# PID creation
# with PID registration in iCAT (4th argument "true")
# EUDATCreatePID(*parent_pid, *source, *ror, "true", *newPID);
EUDATCreatePID("None", *tcoll, "None", "true", *newPID);
writeLine("stdout", "The Collection *tcoll has PID = *newPID");
*tcoll2="*home/test_coll2";
# Data set replication
# with PID registration (3rd argument "true")
# and not recursive (4th argument "true")
*res = EUDATReplication(*tcoll, *tcoll2, "true", "true", *response);
if (*res) {
writeLine("stdout", "Collection *tcoll replicated to Collection *tcoll2!");
writeLine("stdout", "The content of the replicated collection is: *tcoll2/test_data.txt");
writeLine("stdout", "The content of the replicated object *tcoll2/test_data.txt is: ");
msiDataObjOpen("*tcoll2/test_data.txt", *S_FD);
msiDataObjRead(*S_FD, 12,*R_BUF);
writeBytesBuf("stdout", *R_BUF);
msiDataObjClose(*S_FD, *status2);
writeLine("stdout", "");
EUDATiFieldVALUEretrieve("*tcoll2/test_data.txt", "PID", *value);
writeLine("stdout", "The Replica *tcoll2/test_data.txt has PID = *value");
EUDATePIDremove("*tcoll2/test_data.txt", "true");
writeLine("stdout", "PID *value removed");
msiDataObjUnlink("*tcoll2/test_data.txt",*status3);
writeLine("stdout", "Replicated object removed");
EUDATiFieldVALUEretrieve(*tcoll2, "PID", *value);
writeLine("stdout", "The Replica *tcoll2 has PID = *value");
EUDATePIDremove(*tcoll2, "true");
writeLine("stdout", "PID *value removed");
msiRmColl(*tcoll2, "", *status4);
writeLine("stdout", "Replicated collection removed");
}
else {
writeLine("stdout", "Replication failed: *response");
}
EUDATePIDremove("*home/test_coll/test_data.txt", "true");
writeLine("stdout", "PID *newPID removed");
msiDataObjUnlink("*home/test_coll/test_data.txt",*status5);
writeLine("stdout", "Object *home/test_coll/test_data.txt removed");
msiRmColl("*home/test_coll", "", *status6);
writeLine("stdout","Removed collection *home/test_coll");
}
INPUT *home=''
OUTPUT ruleExecOut
eudatRepl{
writeLine("stdout", "userNameClient: $userNameClient");
writeLine("stdout", "rodsZoneClient: $rodsZoneClient");
if (*home == '') {
*home="/$rodsZoneClient/home/$userNameClient";
}
msiDataObjCreate("*home/test_data.txt", "", *fd);
msiDataObjWrite(*fd, "Hello World!", "");
msiDataObjClose(*fd, *status1);
writeLine("stdout", "Object *home/test_data.txt written with success!");
writeLine("stdout", "Its content is: Hello World!");
# Data set replication
# without PID registration (3rd argument "false")
# and not recursive (4th argument "false")
*res = EUDATReplication("*home/test_data.txt", "*home/test_data2.txt", "false", "false", *response);
if (*res) {
writeLine("stdout", "Object *home/test_data.txt replicated to Object *home/test_data2.txt!");
writeLine("stdout", "The content of the replica is:");
msiDataObjOpen("*home/test_data2.txt", *S_FD);
msiDataObjRead(*S_FD, 12,*R_BUF);
writeBytesBuf("stdout", *R_BUF);
msiDataObjClose(*S_FD, *status2);
msiDataObjUnlink("*home/test_data2.txt",*status3);
writeLine("stdout", "");
writeLine("stdout", "Replica removed");
}
else {
writeLine("stdout", "Replication failed: *response");
}
msiDataObjUnlink("*home/test_data.txt",*status4);
writeLine("stdout", "Object *home/test_data.txt removed");
}
INPUT *home=''
OUTPUT ruleExecOut
eudatRepl{
writeLine("stdout", "userNameClient: $userNameClient");
writeLine("stdout", "rodsZoneClient: $rodsZoneClient");
if (*home == '') {
*home="/$rodsZoneClient/home/$userNameClient";
}
msiDataObjCreate("*home/test_data.txt", "", *fd);
msiDataObjWrite(*fd, "Hello World!", "");
msiDataObjClose(*fd, *status1);
writeLine("stdout", "Object *home/test_data.txt written with success!");
writeLine("stdout", "Its content is: Hello World!");
# PID creation
# with PID registration in iCAT (4th argument "true")
# EUDATCreatePID(*parent_pid, *source, *ror, "true", *newPID);
EUDATCreatePID("None", "*home/test_data.txt", "None", "true", *newPID);
writeLine("stdout", "The Object *home/test_data.txt has PID = *newPID");
# Data set replication
# with PID registration (3rd argument "true")
# and not recursive (4th argument "false")
*res = EUDATReplication("*home/test_data.txt", "*home/test_data2.txt", "true", "false", *response);
if (*res) {
writeLine("stdout", "Object *home/test_data.txt replicated to Object *home/test_data2.txt!");
writeLine("stdout", "The content of the replica is:");
msiDataObjOpen("*home/test_data2.txt", *S_FD);
msiDataObjRead(*S_FD, 12,*R_BUF);
writeBytesBuf("stdout", *R_BUF);
msiDataObjClose(*S_FD, *status2);
writeLine("stdout", "");
EUDATiFieldVALUEretrieve("*home/test_data2.txt", "PID", *value);
writeLine("stdout", "The Replica *home/test_data2.txt has PID = *value");
# Alter the content of the replica to simulate a failure
writeLine("stdout", "Altering the replica");
msiDataObjOpen("objPath=*home/test_data2.txt++++openFlags=O_WRONLY", *rfd);
msiDataObjWrite(*rfd, "Hello Worldz!", "");
msiDataObjClose(*rfd, *status3);
writeLine("stdout", "Now the content of the altered replica is:");
msiDataObjOpen("*home/test_data2.txt", *S_FD);
msiDataObjRead(*S_FD, 13,*R_BUF);
writeBytesBuf("stdout", *R_BUF);
msiDataObjClose(*S_FD, *status4);
writeLine("stdout", "");
# Data set integrity check
# with logging enabled (3rd argument "true")
# EUDATCheckIntegrityDO(*source, *destination, *logEnabled, *response);
*status_check = EUDATCheckIntegrityDO("*home/test_data.txt", "*home/test_data2.txt", bool("true"), *response);
if (*status_check) {
writeLine("stdout", "Integrity check after replication: successful!");
}
else {
writeLine("stdout", "Integrity check after replication: failed: *response");
*buffer_length = 1;
EUDATTransferUsingFailLog(*buffer_length, *stats);
writeLine("stdout", "Recovered failed transfer with the following stats: *stats");
writeLine("stdout", "Now the content of the fixed replica is:");
msiDataObjOpen("*home/test_data2.txt", *S_FD);
msiDataObjRead(*S_FD, 12,*R_BUF);
writeBytesBuf("stdout", *R_BUF);
msiDataObjClose(*S_FD, *status4);
writeLine("stdout", "");
}
EUDATePIDremove("*home/test_data2.txt", "true");
writeLine("stdout", "PID *value removed");
msiDataObjUnlink("*home/test_data2.txt",*status5);
writeLine("stdout", "Replica removed");
}
else {
writeLine("stdout", "Replication failed: *response");
}
EUDATePIDremove("*home/test_data.txt", "true");
writeLine("stdout", "PID *newPID removed");
msiDataObjUnlink("*home/test_data.txt",*status6);
writeLine("stdout", "Object *home/test_data.txt removed");
}
INPUT *home=''
OUTPUT ruleExecOut
eudatRepl{
writeLine("stdout", "userNameClient: $userNameClient");
writeLine("stdout", "rodsZoneClient: $rodsZoneClient");
if (*home == '') {
*home="/$rodsZoneClient/home/$userNameClient";
}
msiDataObjCreate("*home/test_data.txt", "", *fd);
msiDataObjWrite(*fd, "Hello World!", "");
msiDataObjClose(*fd, *status1);
writeLine("stdout", "Object *home/test_data.txt written with success!");
writeLine("stdout", "Its content is: Hello World!");
# PID creation
# with PID registration in iCAT (4th argument "true")
# EUDATCreatePID(*parent_pid, *source, *ror, "true", *newPID);
EUDATCreatePID("None", "*home/test_data.txt", "None", "true", *newPID);
writeLine("stdout", "The Object *home/test_data.txt has PID = *newPID");
# Data set replication
# with PID registration (3rd argument "true")
# and not recursive (4th argument "false")
*res = EUDATReplication("*home/test_data.txt", "*home/test_data2.txt", "true", "false", *response);
if (*res) {
writeLine("stdout", "Object *home/test_data.txt replicated to Object *home/test_data2.txt!");
writeLine("stdout", "The content of the replica is:");
msiDataObjOpen("*home/test_data2.txt", *S_FD);
msiDataObjRead(*S_FD, 12,*R_BUF);
writeBytesBuf("stdout", *R_BUF);
msiDataObjClose(*S_FD, *status2);
writeLine("stdout", "");
EUDATiFieldVALUEretrieve("*home/test_data2.txt", "PID", *value);
writeLine("stdout", "The Replica *home/test_data2.txt has PID = *value");
EUDATePIDremove("*home/test_data2.txt", "true");
writeLine("stdout", "PID *value removed");
msiDataObjUnlink("*home/test_data2.txt",*status3);
writeLine("stdout", "Replica removed");
}
else {
writeLine("stdout", "Replication failed: *response");
}
EUDATePIDremove("*home/test_data.txt", "true");
writeLine("stdout", "PID *newPID removed");
msiDataObjUnlink("*home/test_data.txt",*status4);
writeLine("stdout", "Object *home/test_data.txt removed");
}
INPUT *home=''
OUTPUT ruleExecOut
eudatTD{
# Calculate the difference between the creation time
# and the modification time of an object. In seconds.
EUDATgetObjectTimeDiff(*filePath, *mode, *age);
# Calculate the difference between the current time
# and the modification time of an object. In seconds.
EUDATgetObjectAge(*filePath, *age1);
}
INPUT *filePath='/cinecaDMPZone2/home/rods/2.txt', *mode='1'
OUTPUT *age,*age1,ruleExecOut
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment