Skip to content

Commit

Permalink
Checkpoint in DAQ room before Global Run 4 preparation begins with Giani
Browse files Browse the repository at this point in the history
  • Loading branch information
rrivera747 committed Jan 9, 2025
1 parent 3a6c65e commit a3b6e8c
Show file tree
Hide file tree
Showing 5 changed files with 1,840 additions and 7 deletions.
1 change: 1 addition & 0 deletions otsdaq/GatewaySupervisor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cet_make_library(LIBRARY_NAME GatewaySupervisor
SOURCE
GatewaySupervisor.cc
Iterator.cc
PixelHistoPicGen.cc
version.cc
LIBRARIES PRIVATE
otsdaq::CoreSupervisors
Expand Down
43 changes: 43 additions & 0 deletions otsdaq/GatewaySupervisor/GatewaySupervisor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ GatewaySupervisor::GatewaySupervisor(xdaq::ApplicationStub* s)
xgi::bind(this, &GatewaySupervisor::stateMachineXgiHandler, "StateMachineXgiHandler");
xgi::bind(this, &GatewaySupervisor::stateMachineIterationBreakpoint, "StateMachineIterationBreakpoint");
xgi::bind(this, &GatewaySupervisor::tooltipRequest, "TooltipRequest");
xgi::bind(this, &GatewaySupervisor::XGI_Turtle, "XGI_Turtle");

xoap::bind(this, &GatewaySupervisor::supervisorCookieCheck, "SupervisorCookieCheck", XDAQ_NS_URI);
xoap::bind(this, &GatewaySupervisor::supervisorGetActiveUsers, "SupervisorGetActiveUsers", XDAQ_NS_URI);
Expand Down Expand Up @@ -2060,6 +2061,48 @@ std::string GatewaySupervisor::getIconHeaderString(void)

} // end getIconHeaderString()

//==============================================================================
////////////////////////////////////////////////////////////////////////
void GatewaySupervisor::XGI_Turtle(xgi::Input * /*in*/, xgi::Output * out )
{
//test if ImageMagick is installed to do convert, if not just return existing png
if(!picGen_.imageMagickInstallChecked)
{
//to install on AL9, sudo dnf install -y ImageMagick
std::string ret = StringMacros::exec("convert --version"); //check if ImageMagick is installed
__COUTVS__(50,ret);
picGen_.imageMagickInstallChecked = true;
picGen_.imageMagickInstalled = ret == ""?false:true;
}

std::string filepath = __ENV__("OTSDAQ_WEB_PATH")+ std::string("/images/otsdaqIcons/");

std::string filename = filepath + "generated/turtle.png";
if(picGen_.imageMagickInstalled)
picGen_.generateTurtle(filepath);
else
filename = filepath + "turtle.png";

//insertPngRawData(out,"images/generated/turtle.png");
{

//write raw picture data to output stream
std::ifstream is;
is.open(filename.c_str());

*out << "data:image/png;charset=US-ASCII,";

char CodeURL[4];
while(is.good())
{ //print out safe Ascii equivalent
sprintf(CodeURL,"%%%2.2X",(unsigned char)(is.get()));
*out << CodeURL;
}

is.close();
}
} //end XGI_Turtle()

//==============================================================================
// stateMachineIterationBreakpoint
// get/set the state machine iteration breakpoint
Expand Down
17 changes: 10 additions & 7 deletions otsdaq/GatewaySupervisor/GatewaySupervisor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <toolbox/task/WorkLoop.h>
#include <xdata/String.h>
#include <xgi/Method.h>
#include "otsdaq/GatewaySupervisor/PixelHistoPicGen.h"

#include <set>
#include <sstream>
Expand Down Expand Up @@ -57,16 +58,17 @@ class WorkLoopManager;
public:
XDAQ_INSTANTIATOR();

GatewaySupervisor(xdaq::ApplicationStub* s);
virtual ~GatewaySupervisor(void);
GatewaySupervisor (xdaq::ApplicationStub* s);
virtual ~GatewaySupervisor (void);

void init(void);
void init (void);

void Default(xgi::Input* in, xgi::Output* out);
void Default (xgi::Input* in, xgi::Output* out);

void loginRequest(xgi::Input* in, xgi::Output* out);
void request(xgi::Input* in, xgi::Output* out);
void tooltipRequest(xgi::Input* in, xgi::Output* out);
void loginRequest (xgi::Input* in, xgi::Output* out);
void request (xgi::Input* in, xgi::Output* out);
void tooltipRequest (xgi::Input* in, xgi::Output* out);
void XGI_Turtle (xgi::Input* in, xgi::Output* out);

void addStateMachineStatusToXML (HttpXmlDocument& xmlOut, const std::string& fsmName, bool getRunNumber = true);
void addFilteredConfigAliasesToXML (HttpXmlDocument& xmlOut, const std::string& fsmName);
Expand Down Expand Up @@ -338,6 +340,7 @@ class WorkLoopManager;
static std::vector<std::shared_ptr<GatewaySupervisor::BroadcastThreadStruct>> broadcastThreadStructs_; //moving to static, instead of a local instance inside broadcastMessage() seems to avoid crashing when multiple error stack up and threads get stuck waiting for app replies

std::string securityType_;
PixelHistoPicGen picGen_;

//Variable used by the RunInfo plugin
unsigned int conditionID_;
Expand Down
Loading

0 comments on commit a3b6e8c

Please sign in to comment.