ACS Error System - 6th ACS Workshop at UTFSM 2009
ACS Error System - 6th ACS Workshop at UTFSM 2009
ACS Error System - 6th ACS Workshop at UTFSM 2009
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>ACS</strong><strong>Error</strong> <strong>System</strong>Bogdan Jeram(bjeram@eso.org)European Southern Observ<strong>at</strong>oryJuly 2005ESO
SummaryALMA Project• Fe<strong>at</strong>ures• Completions/<strong>Error</strong>s• Architecture• <strong>Error</strong> represent<strong>at</strong>ion/structures/propag<strong>at</strong>ion• <strong>Error</strong> Trace• Code gener<strong>at</strong>ion• Defining new errors• Programming language support• Remote error handlingJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 2
Fe<strong>at</strong>uresALMA Project• support for distributed and heterogeneoussystem• support synchronous and asynchronous calls• <strong>Error</strong>s traceability• support different programming language (eg.C++, Java, Python)• easy to use within all programming languagessupported by <strong>ACS</strong>July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 3
Completions and <strong>Error</strong>sALMA Project• reporting how an action has completed• an action can complete:– erroneous (different ways)– successful (different ways)• completion for reporting:– errors– different success completion– intermedi<strong>at</strong>e st<strong>at</strong>us of an action• completions are superset of errorsJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 4
ArchitectureALMA ProjectGUICompletion & <strong>Error</strong>definition(XML)Codegener<strong>at</strong>ors(XSLT)CDB(Archive)<strong>Error</strong> LogBrowser(GUI)errorlibraryIDLJavaPythonApplic<strong>at</strong>ionC++Loggingsystemnot part oferror systemnot yet availableJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 5
<strong>Error</strong> represent<strong>at</strong>ionALMA Project• each completion/error is defined with twonumbers:– type (group)– code• OO mapping:– type -> namespace / IDL module– code -> completion class/ exception classJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 6
<strong>Error</strong> structuresALMA Project• error trace (can not exist standalone)– type+code– severity: <strong>Error</strong>, Critical, Alert, Emergency– timestamp– source code info: line, file, routine– run-time info: process name, thread ID, host name– arbitrary d<strong>at</strong>a in name-value form<strong>at</strong> (generic) or members• exception classes (contain error trace)• completion classes:– non-error– error (contain error trace)July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 7
Arbitrary d<strong>at</strong>aALMA Project• generic way: name-value pairs• members:– defined together with error: name, type and description(document<strong>at</strong>ion)– gener<strong>at</strong>ed getter/setter methods– stored in name-value pairs (accessed in a generic way)– new with <strong>ACS</strong> 4.1– just in C++, but can be accessed in Java and PythonJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 8
<strong>Error</strong> TraceALMA Project• linked list of objects/structures/exceptions• chain of calls cre<strong>at</strong>e an error trace: <strong>at</strong> eachlevel error inform<strong>at</strong>ion can be added• It is contained inside:– an exception– a completionJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 9
<strong>Error</strong> TraceALMA Projectlength of error traceerror(n-1)error(n-2)depth of callserror1error0July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 10
Example of error traceALMA Project<strong>ACS</strong>Err::Completion* Ex::op(){er2 = newRecordNotFoundCompletion(“getRecord”);}er1 = newPositionNotObtainedCompletion(er2,“getPosition”)er1->returnCompletion();<strong>ACS</strong>Err::Completion *c = …->op();er = new PointingFailureCompletion(c,“routine”);er->log();er2er1 er2er1 er2er er1 er2July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 11
Example of <strong>Error</strong> TraceALMA Projectf1(…)f2(…)er2 er1 er0er2 er1 er0f3(…)f4(…)er1er0er0July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 12
<strong>Error</strong> propag<strong>at</strong>ionALMA Project• throwing exception:– just for reporting errors• returning/sending completion structure:– asynchronous actions/communic<strong>at</strong>ions(callback mechanism)– reporting different success st<strong>at</strong>uses of theoper<strong>at</strong>ion– where exceptions are not supported e.g. oldC++ compilersJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 13
<strong>Error</strong> Definition (XML)ALMA Project...July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 14
Code gener<strong>at</strong>ionALMA ProjectCompletion&errordefinitionXML fileXSLT forIDLXSLT forC++XSLT forJavaXSLT forPythonIDL C++ Java PythonJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 15
Programming language supportALMA Project• Supported languages:– IDL (remote)– C++– Java– Python• Gener<strong>at</strong>ed code + libraryJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 17
CORBA (remote) error handlingALMA Project• Common IDL structures:– error trace– completion+• Gener<strong>at</strong>ed IDL code:– exceptionJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 18
Class diagram of IDLALMA Project+previous<strong>Error</strong>0..n<strong>Error</strong>Code<strong>ACS</strong>ErrTypeSeverity<strong>Error</strong>CriticalAlertEmergency+errorCode+errorType+severity<strong>Error</strong>Tracefile : stringlineNum : longroutine : stringhost : stringprocess : stringthread : stringtimeStamp : unsigned long longshortDescription : string0..1+errorTraceCompletiontimeStamptypecode+d<strong>at</strong>aNameValueSeq0..nNameValuename : stringvalue : stringJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 19
IDL: <strong>Error</strong> Trace (1/2)ALMA Project• IDL structure to hold error trace inform<strong>at</strong>ion:<strong>ACS</strong>Err::<strong>Error</strong>Trace– error: type & code , severity (<strong>Error</strong>, Critical, Alert, Emergency)– timestamp– runtime inform<strong>at</strong>ion: process, thread, host– source inform<strong>at</strong>ion: file name, line number, routine name– additional info: pairs of name-value– “pointer” to the previous error• <strong>Error</strong> trace is not used standalone, but as a part of:– completion structure– exceptionsJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 20
IDL: <strong>Error</strong> Trace (2/2)ALMA Projectstruct <strong>Error</strong>Trace {string file;long lineNum;string routine;string host;string process;string thread;TimeStamp timeStamp;string shortDescription;<strong>ACS</strong>Err::<strong>ACS</strong>ErrType errorType;<strong>ACS</strong>Err::<strong>Error</strong>Code errorCode;<strong>ACS</strong>Err::Severity severity;NameValueSeq d<strong>at</strong>a;sequence previous<strong>Error</strong>;};July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 21
IDL: CompletionALMA Project• can contain <strong>ACS</strong>Err::<strong>Error</strong>Tracestruct Completion {TimeStamp timeStamp;<strong>ACS</strong>Err::<strong>ACS</strong>ErrType type;<strong>ACS</strong>Err::<strong>Error</strong>Code code;sequenceprevious<strong>Error</strong>;};July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 22
Example (remote) IDLALMA Project• error is sent around as return value or (in)outparameter of IDL structure(<strong>ACS</strong>Err::Completion):#include interface Ex {<strong>ACS</strong>Err::Completion op(…);}July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 23
IDL: ExceptionsALMA Project• there is no exception hierarchy in IDL!• gener<strong>at</strong>ed from XML error definition file• containers for <strong>ACS</strong>Err::<strong>Error</strong>Tracemodule {};exception Ex {<strong>Error</strong>Trace error;};July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 24
Example exception (remote) IDLALMA Project• error is send around as IDL exception(<strong>ACS</strong>ErrType<strong>ACS</strong>Course::TargetNotFoundEx):#include interface Ex {void readFile(…) raises(<strong>ACS</strong>ErrType<strong>ACS</strong>Course::TargetNotFoundEx);}July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 25
ReferencesALMA Project• Doxygen document<strong>at</strong>ion:$<strong>ACS</strong>ROOT/man/api/html/acserr_8h.html• OCI, TAO Developers Guide version 1.1aChapter x: <strong>Error</strong> HandlingJuly 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 26
Exercise(s)ALMA Project• implement error handling in your“component”:– component oper<strong>at</strong>ion(s) should returnCompletion or throw an exception (change IDLand implement<strong>at</strong>ion)July 2005 <strong>ACS</strong> <strong>Error</strong> <strong>System</strong> 27