how to debug Prelude.read: no parse

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to debug Prelude.read: no parse

PICCA Frederic-Emmanuel
Hello, I am using the soap package and wrote a StreamParser which use the Consuite Xml system

I have this kind of error when I execute my code

[picca@process2 autoprocess-exe]$ stack exec autoprocessing-exe -- exec --json \{\"tag\":\"XdsMe\",\"contents\":[39878,[0,0,0,0,22,0],null,\"UnCompressed\"]\} +RTS -xc -Pa
response:<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:findDataCollectionResponse xmlns:ns2="http://ispyb.ejb3.webservices.collection"><dataCollection><actualCenteringPosition> /omega=280.000125 /phi=0.000020 /uglidex=-1.403875 /phiz=-0.127760 /chi=0.000005 /uglidey=-0.508216 /zoom=646.972000</actualCenteringPosition><axisEnd>180.0</axisEnd><axisRange>0.1</axisRange><axisStart>0.0</axisStart><beamShape>rectangular</beamShape><beamSizeAtSampleX>100.0</beamSizeAtSampleX><beamSizeAtSampleY>100.0</beamSizeAtSampleY><dataCollectionId>39878</dataCollectionId><dataCollectionNumber>1</dataCollectionNumber><detector2theta>0.0</detector2theta><detectorDistance>296.869</detectorDistance><endTime>2018-11-21T16:54:18+01:00</endTime><exposureTime>0.025</exposureTime><fileTemplate>C2-BZ1692_1</fileTemplate><flux>1.27E10</flux><flux_end>1.27E10</flux_end><imageDirectory>/data4/proxima1-soleil/2018_Run5/2018-11-21/20180897/RAW_DATA/C2/C2-BZ1692</imageDirectory><imagePrefix>C2-BZ1692</imagePrefix><imageSuffix>h5</imageSuffix><kappaStart>0.0</kappaStart><numberOfImages>1800</numberOfImages><numberOfPasses>1</numberOfPasses><overlap>0.0</overlap><phiStart>0.0</phiStart><printableForReport>1</printableForReport><resolution>1.99996</resolution><rotationAxis>Phi</rotationAxis><runStatus>Data collection successful</runStatus><slitGapHorizontal>9999.0</slitGapHorizontal><slitGapVertical>9999.0</slitGapVertical><startImageNumber>1</startImageNumber><startTime>2018-11-21T16:52:42+01:00</startTime><synchrotronMode>Hybrid</synchrotronMode><transmission>20.1</transmission><undulatorGap1>6.4649</undulatorGap1><wavelength>0.978566</wavelength><xbeam>2044.1</xbeam><ybeam>2291.12</ybeam><dataCollectionGroupId>41587</dataCollectionGroupId></dataCollection></ns2:findDataCollectionResponse></soap:Body></soap:Envelope>
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Data.Conduit.Internal.Conduit.fmap.\,
  called from Data.Conduit.Internal.Conduit.fmap,
  called from Network.SOAP.Parsing.Stream.readContent,
  called from Network.SOAP.Parsing.Stream.readTag,
  called from ISPyB.Soap.toResponseParser,
  called from Data.Conduit.Internal.Conduit.pure,
  called from Data.Conduit.Internal.Conduit.>>=.\.\,
  called from Data.Conduit.Internal.Conduit.>>=.\,
  called from Data.Conduit.Internal.Conduit.>>=,
  called from Text.XML.Stream.Parse.force,
  called from Network.SOAP.unwrapEnvelopeSink,
  called from Network.SOAP.runResponseParser,
  called from Network.SOAP.invokeWS,
  called from ISPyB.Soap.callISPyBService,
  called from XdsMe.xdsme,
  called from JobParser.runJob,
  called from Main.run,
  called from Main.main
autoprocessing-exe: Prelude.read: no parse
CallStack (from -prof):
  Data.Conduit.Internal.Conduit.fmap.\ (src/Data/Conduit/Internal/Conduit.hs:140:47-58)
  Data.Conduit.Internal.Conduit.fmap (src/Data/Conduit/Internal/Conduit.hs:140:5-58)
  Network.SOAP.Parsing.Stream.readContent (src/Network/SOAP/Parsing/Stream.hs:57:1-46)
  Network.SOAP.Parsing.Stream.readTag (src/Network/SOAP/Parsing/Stream.hs:61:1-33)
  ISPyB.Soap.toResponseParser (src/ISPyB/Soap.hs:(65,5)-(129,74))
  Data.Conduit.Internal.Conduit.pure (src/Data/Conduit/Internal/Conduit.hs:143:5-27)
  Data.Conduit.Internal.Conduit.>>=.\.\ (src/Data/Conduit/Internal/Conduit.hs:150:51-68)
  Data.Conduit.Internal.Conduit.>>=.\ (src/Data/Conduit/Internal/Conduit.hs:150:41-68)
  Data.Conduit.Internal.Conduit.>>= (src/Data/Conduit/Internal/Conduit.hs:150:5-68)
  Text.XML.Stream.Parse.force (Text/XML/Stream/Parse.hs:873:1-68)
  Network.SOAP.unwrapEnvelopeSink (src/Network/SOAP.hs:(79,1)-(81,30))
  Network.SOAP.runResponseParser (src/Network/SOAP.hs:(61,1)-(76,31))
  Network.SOAP.invokeWS (src/Network/SOAP.hs:(55,1)-(58,27))
  ISPyB.Soap.callISPyBService (src/ISPyB/Soap.hs:(310,1)-(325,93))
  XdsMe.xdsme (src/XdsMe.hs:(176,1)-(179,77))
  JobParser.runJob (src/JobParser.hs:(80,1)-(84,57))
  Main.run (app/Main.hs:(112,1)-(114,31))
  Main.main (app/Main.hs:(118,1)-(123,72))


I generate the stacktrace with  RTS.

but now I know theat my error is in the roRespondParser whcih is quite long

here the code


instance a ~ b => ToResponseParser (ToolsForCollectionWebService a) b where
    toResponseParser (FindDataCollection _) =
        StreamParser . flaxTag "findDataCollectionResponse" . flaxTag "dataCollection" $
        mkSomeDataCollection <$>
                     ( DataCollection
                       <$> flaxContent "actualCenteringPosition"
                       <*> readTag "axisEnd"
                       <*> readTag "axisRange"
                       <*> readTag "axisStart"
                       <*> flaxContent "beamShape"
                       <*> readTag "beamSizeAtSampleX"
                       <*> readTag "beamSizeAtSampleY"
                       <*> laxTag "centeringMethod" readContent
                       <*> (DataCollectionId <$> readTag "dataCollectionId")
                       <*> readTag "dataCollectionNumber"
                       <*> readTag "detector2theta"
                       <*> readTag "detectorDistance"
                       <*> flaxContent "endTime"
                       <*> readTag "exposureTime"
                       <*> flaxContent "fileTemplate"
                       <*> readTag "flux"
                       <*> readTag "flux_end"
                       <*> flaxTag "imageDirectory" parseAbsDir'
                       <*> flaxContent "imagePrefix"
                       <*> laxContent "imageSuffix"
                       <*> readTag "kappaStart"
                       <*> readTag "numberOfImages"
                       <*> readTag "numberOfPasses"
                       <*> laxTag "omegaStart" readContent
                       <*> readTag "overlap"
                       <*> readTag "phiStart"
                       <*> readTag "printableForReport"
                       <*> readTag "resolution"
                       <*> laxTag "resolutionAtCorner" readContent
                       <*> readTag "rotationAxis"
                       <*> flaxContent "runStatus"
                       <*> readTag "slitGapHorizontal"
                       <*> readTag "slitGapVertical"
                       <*> readTag "startImageNumber"
                       <*> readTag "startTime"
                       <*> readTag "synchrotronMode"
                       <*> readTag "transmission"
                       <*> readTag "undulatorGap1"
                       <*> laxTag "undulatorGap2" readContent
                       <*> readTag "wavelength" -- add the unit
                       <*> readTag "xbeam"
                       <*> laxTag "xtalSnapshotFullPath1" parseAbsFile'
                       <*> laxTag "xtalSnapshotFullPath2" parseAbsFile'
                       <*> laxTag "xtalSnapshotFullPath3" parseAbsFile'
                       <*> laxTag "xtalSnapshotFullPath4" parseAbsFile'
                       <*> readTag "ybeam"
                       <*> readTag "dataCollectionGroupId"
                     )


Now I would like to know whcih line is problematic. Is it possible to have more information when debuging ?

I really want to know which part of my response is wrong ?

thansk for your advices.

Frederic
_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: how to debug Prelude.read: no parse

David McBride
Assuming the read call is in your code, you can use readNote and its variants from the 'safe' package.  If it isn't in your code, you may have to modify the library you are using to make use of it in order to find the exact text that is being read unsuccessfully.

On Wed, Nov 21, 2018 at 4:40 PM PICCA Frederic-Emmanuel <[hidden email]> wrote:
Hello, I am using the soap package and wrote a StreamParser which use the Consuite Xml system

I have this kind of error when I execute my code

[picca@process2 autoprocess-exe]$ stack exec autoprocessing-exe -- exec --json \{\"tag\":\"XdsMe\",\"contents\":[39878,[0,0,0,0,22,0],null,\"UnCompressed\"]\} +RTS -xc -Pa
response:<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:findDataCollectionResponse xmlns:ns2="http://ispyb.ejb3.webservices.collection"><dataCollection><actualCenteringPosition> /omega=280.000125 /phi=0.000020 /uglidex=-1.403875 /phiz=-0.127760 /chi=0.000005 /uglidey=-0.508216 /zoom=646.972000</actualCenteringPosition><axisEnd>180.0</axisEnd><axisRange>0.1</axisRange><axisStart>0.0</axisStart><beamShape>rectangular</beamShape><beamSizeAtSampleX>100.0</beamSizeAtSampleX><beamSizeAtSampleY>100.0</beamSizeAtSampleY><dataCollectionId>39878</dataCollectionId><dataCollectionNumber>1</dataCollectionNumber><detector2theta>0.0</detector2theta><detectorDistance>296.869</detectorDistance><endTime>2018-11-21T16:54:18+01:00</endTime><exposureTime>0.025</exposureTime><fileTemplate>C2-BZ1692_1</fileTemplate><flux>1.27E10</flux><flux_end>1.27E10</flux_end><imageDirectory>/data4/proxima1-soleil/2018_Run5/2018-11-21/20180897/RAW_DATA/C2/C2-BZ1692</imageDirectory><imagePrefix>C2-BZ1692</imagePrefix><imageSuffix>h5</imageSuffix><kappaStart>0.0</kappaStart><numberOfImages>1800</numberOfImages><numberOfPasses>1</numberOfPasses><overlap>0.0</overlap><phiStart>0.0</phiStart><printableForReport>1</printableForReport><resolution>1.99996</resolution><rotationAxis>Phi</rotationAxis><runStatus>Data collection successful</runStatus><slitGapHorizontal>9999.0</slitGapHorizontal><slitGapVertical>9999.0</slitGapVertical><startImageNumber>1</startImageNumber><startTime>2018-11-21T16:52:42+01:00</startTime><synchrotronMode>Hybrid</synchrotronMode><transmission>20.1</transmission><undulatorGap1>6.4649</undulatorGap1><wavelength>0.978566</wavelength><xbeam>2044.1</xbeam><ybeam>2291.12</ybeam><dataCollectionGroupId>41587</dataCollectionGroupId></dataCollection></ns2:findDataCollectionResponse></soap:Body></soap:Envelope>
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Data.Conduit.Internal.Conduit.fmap.\,
  called from Data.Conduit.Internal.Conduit.fmap,
  called from Network.SOAP.Parsing.Stream.readContent,
  called from Network.SOAP.Parsing.Stream.readTag,
  called from ISPyB.Soap.toResponseParser,
  called from Data.Conduit.Internal.Conduit.pure,
  called from Data.Conduit.Internal.Conduit.>>=.\.\,
  called from Data.Conduit.Internal.Conduit.>>=.\,
  called from Data.Conduit.Internal.Conduit.>>=,
  called from Text.XML.Stream.Parse.force,
  called from Network.SOAP.unwrapEnvelopeSink,
  called from Network.SOAP.runResponseParser,
  called from Network.SOAP.invokeWS,
  called from ISPyB.Soap.callISPyBService,
  called from XdsMe.xdsme,
  called from JobParser.runJob,
  called from Main.run,
  called from Main.main
autoprocessing-exe: Prelude.read: no parse
CallStack (from -prof):
  Data.Conduit.Internal.Conduit.fmap.\ (src/Data/Conduit/Internal/Conduit.hs:140:47-58)
  Data.Conduit.Internal.Conduit.fmap (src/Data/Conduit/Internal/Conduit.hs:140:5-58)
  Network.SOAP.Parsing.Stream.readContent (src/Network/SOAP/Parsing/Stream.hs:57:1-46)
  Network.SOAP.Parsing.Stream.readTag (src/Network/SOAP/Parsing/Stream.hs:61:1-33)
  ISPyB.Soap.toResponseParser (src/ISPyB/Soap.hs:(65,5)-(129,74))
  Data.Conduit.Internal.Conduit.pure (src/Data/Conduit/Internal/Conduit.hs:143:5-27)
  Data.Conduit.Internal.Conduit.>>=.\.\ (src/Data/Conduit/Internal/Conduit.hs:150:51-68)
  Data.Conduit.Internal.Conduit.>>=.\ (src/Data/Conduit/Internal/Conduit.hs:150:41-68)
  Data.Conduit.Internal.Conduit.>>= (src/Data/Conduit/Internal/Conduit.hs:150:5-68)
  Text.XML.Stream.Parse.force (Text/XML/Stream/Parse.hs:873:1-68)
  Network.SOAP.unwrapEnvelopeSink (src/Network/SOAP.hs:(79,1)-(81,30))
  Network.SOAP.runResponseParser (src/Network/SOAP.hs:(61,1)-(76,31))
  Network.SOAP.invokeWS (src/Network/SOAP.hs:(55,1)-(58,27))
  ISPyB.Soap.callISPyBService (src/ISPyB/Soap.hs:(310,1)-(325,93))
  XdsMe.xdsme (src/XdsMe.hs:(176,1)-(179,77))
  JobParser.runJob (src/JobParser.hs:(80,1)-(84,57))
  Main.run (app/Main.hs:(112,1)-(114,31))
  Main.main (app/Main.hs:(118,1)-(123,72))


I generate the stacktrace with  RTS.

but now I know theat my error is in the roRespondParser whcih is quite long

here the code


instance a ~ b => ToResponseParser (ToolsForCollectionWebService a) b where
    toResponseParser (FindDataCollection _) =
        StreamParser . flaxTag "findDataCollectionResponse" . flaxTag "dataCollection" $
        mkSomeDataCollection <$>
                     ( DataCollection
                       <$> flaxContent "actualCenteringPosition"
                       <*> readTag "axisEnd"
                       <*> readTag "axisRange"
                       <*> readTag "axisStart"
                       <*> flaxContent "beamShape"
                       <*> readTag "beamSizeAtSampleX"
                       <*> readTag "beamSizeAtSampleY"
                       <*> laxTag "centeringMethod" readContent
                       <*> (DataCollectionId <$> readTag "dataCollectionId")
                       <*> readTag "dataCollectionNumber"
                       <*> readTag "detector2theta"
                       <*> readTag "detectorDistance"
                       <*> flaxContent "endTime"
                       <*> readTag "exposureTime"
                       <*> flaxContent "fileTemplate"
                       <*> readTag "flux"
                       <*> readTag "flux_end"
                       <*> flaxTag "imageDirectory" parseAbsDir'
                       <*> flaxContent "imagePrefix"
                       <*> laxContent "imageSuffix"
                       <*> readTag "kappaStart"
                       <*> readTag "numberOfImages"
                       <*> readTag "numberOfPasses"
                       <*> laxTag "omegaStart" readContent
                       <*> readTag "overlap"
                       <*> readTag "phiStart"
                       <*> readTag "printableForReport"
                       <*> readTag "resolution"
                       <*> laxTag "resolutionAtCorner" readContent
                       <*> readTag "rotationAxis"
                       <*> flaxContent "runStatus"
                       <*> readTag "slitGapHorizontal"
                       <*> readTag "slitGapVertical"
                       <*> readTag "startImageNumber"
                       <*> readTag "startTime"
                       <*> readTag "synchrotronMode"
                       <*> readTag "transmission"
                       <*> readTag "undulatorGap1"
                       <*> laxTag "undulatorGap2" readContent
                       <*> readTag "wavelength" -- add the unit
                       <*> readTag "xbeam"
                       <*> laxTag "xtalSnapshotFullPath1" parseAbsFile'
                       <*> laxTag "xtalSnapshotFullPath2" parseAbsFile'
                       <*> laxTag "xtalSnapshotFullPath3" parseAbsFile'
                       <*> laxTag "xtalSnapshotFullPath4" parseAbsFile'
                       <*> readTag "ybeam"
                       <*> readTag "dataCollectionGroupId"
                     )


Now I would like to know whcih line is problematic. Is it possible to have more information when debuging ?

I really want to know which part of my response is wrong ?

thansk for your advices.

Frederic
_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners