Skip to content
Snippets Groups Projects
Commit e8b67a43 authored by Michael Davis's avatar Michael Davis
Browse files

[frontend] Adds PREPARE to cta-send-event

parent 13094904
Branches
Tags
No related merge requests found
......@@ -46,7 +46,7 @@ void RequestCallback<cta::xrd::Alert>::operator()(const cta::xrd::Alert &alert)
typedef std::map<std::string, std::string> AttrMap;
// Usage exception
const std::runtime_error Usage("Usage: eos --json fileinfo /eos/path | cta-send-event [eos_hostname:port] CLOSEW|PREPARE|ABORT_PREPARE");
const std::runtime_error Usage("Usage: eos --json fileinfo /eos/path | cta-send-event [eos_hostname:port] CLOSEW|PREPARE");
// remove leading spaces and quotes
void ltrim(std::string &s) {
......@@ -124,10 +124,6 @@ void fillNotification(cta::eos::Notification &notification, int argc, const char
{
notification.mutable_wf()->set_event(cta::eos::Workflow::PREPARE);
}
else if(wf_command == "ABORT_PREPARE")
{
notification.mutable_wf()->set_event(cta::eos::Workflow::ABORT_PREPARE);
}
else {
throw Usage;
}
......@@ -144,10 +140,11 @@ void fillNotification(cta::eos::Notification &notification, int argc, const char
std::string errorReportUrl = "eosQuery://" + eos_endpoint + "//eos/wfe/passwd?mgm.pcmd=event&mgm.fid=" + attr["fxid"] +
"&mgm.logid=cta&mgm.event=sync::archive_failed&mgm.workflow=default&mgm.path=/dummy_path&mgm.ruid=0&mgm.rgid=0&cta_archive_file_id=" +
xattrs["sys.archive.file_id"] + "&mgm.errmsg=";
std::string destUrl = "TO DO"; // TO DO: required only for retrieve workflow
std::string destUrl = "root://" + eos_endpoint + "/" + attr["path"] + "?eos.lfn=fxid:" + attr["fxid"] +
"&eos.ruid=0&eos.rgid=0&eos.injection=1&eos.workflow=retrieve_written&eos.space=default";
// WF
notification.mutable_wf()->mutable_instance()->set_name(attr["geotag"]);
notification.mutable_wf()->mutable_instance()->set_name(attr["instance"]);
notification.mutable_wf()->mutable_instance()->set_url(accessUrl);
notification.mutable_wf()->set_requester_instance("cta-send-event");
......
#!/bin/sh
#
# Send a CLOSEW event to the CTA Frontend in order to retry a failed archive request
CTA_SEND_EVENT=/usr/bin/cta-send-event
EOS_HOST=localhost:1094
error()
{
echo "$*" >&2
exit 1
}
get_eos_md()
{
eos --json fileinfo $1
[ $? -eq 0 ] || error "$(basename $0): Cannot open $1 for reading"
}
[ $# -gt 0 ] || error "Usage: $(basename $0) /eos/path [/eos/path...]"
[ -x ${CTA_SEND_EVENT} ] || error "Cannot execute ${CTA_SEND_EVENT}"
for FILENAME in $*
do
get_eos_md $FILENAME | ${CTA_SEND_EVENT} ${EOS_HOST} CLOSEW
done
#!/bin/sh
#
# Send CLOSEW or PREPARE events to the CTA Frontend to retry failed archive or retrieval requests
CTA_SEND_EVENT=/usr/bin/cta-send-event
EOS_HOST=localhost:1094
error()
{
echo "$*" >&2
exit 1
}
usage()
{
echo "Usage: $(basename $0) CLOSEW|PREPARE <eos_instance> /eos/path [/eos/path...]" >&2
exit 2
}
[ $# -gt 2 ] || usage
EVENT=$1
shift
[ "${EVENT}" == "CLOSEW" -o "${EVENT}" == "PREPARE" ] || usage
INSTANCE=$1
shift
[ -x ${CTA_SEND_EVENT} ] || error "Cannot execute ${CTA_SEND_EVENT}"
for FILENAME in $*
do
FILEMD=$(eos --json fileinfo $1)
[ "$(echo "$FILEMD" | jq .retc)" == "null" ] || error "$(basename $0): Cannot open $1 for reading"
echo ${FILEMD} | jq ".instance = \"${INSTANCE}\"" | ${CTA_SEND_EVENT} ${EOS_HOST} ${EVENT}
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment