chop-dbhi / data-models-validator

Set of tools for validating data that should conform to a data model.
1 stars 2 forks source link

Client error on fast repeat runs #9

Closed gracebrownecodes closed 8 years ago

gracebrownecodes commented 8 years ago

It seems that if you run the validator three times in quick succession, the client throws an error:

$ data-models-validator -model i2b2_pedsnet -version 2.0.0 BOM-test-validator-obs-fact.csv:observation_fact
error decoding model revisions: invalid character '<' looking for beginning of value

This has happened across two model versions and several different target files for me. After waiting for a couple minutes (?) I can run again without the error.

bruth commented 8 years ago

That error is being returned from here which is a decoding issue. What is curious is non-2xx status codes are returned as an error here. The issue could be originating with the service itself here.

gracebrownecodes commented 8 years ago

I found that I can reproduce this error only when connected to the CHOP intranet (via WiFi or VPN). In other words, when I am on the "open" web, I do not get the error.

I was also able to print out the body of the response and got:

<!doctype html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Data Models Service</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>...css...</style>
</head>
<body>
    <div id='header'>
        <a class='brand' href='/'>Data Models</a>

        <ul>
            <li><a href='/models'>Models</a></li>
            <li><a href='/repos'>Repos</a></li>
        </ul>
    </div>

    <a id='scroll-anchor' href='#'>Top</a>

    <div class='markdown-body'>
        <h1>i2b2_pedsnet</h1>

<ul>
<li><a href="/models/i2b2_pedsnet/2.0.0">i2b2 for PEDSnet</a></li>
</ul>

    </div>

    <script>
        (function() {

            // Debounce executes only the last call of a function after the
            // specified wait period.
            function debounce(func, wait, immediate) {
                var timeout;

                return function() {
                    var context = this,
                        args = arguments;

                    var later = function() {
                        timeout = null;
                        if (!immediate) func.apply(context, args);
                    };

                    var callNow = immediate && !timeout;

                    clearTimeout(timeout);
                    timeout = setTimeout(later, wait);

                    if (callNow) func.apply(context, args);
                };
            };

            var scrollAnchor = document.getElementById('scroll-anchor');

            // Scroll to top.
            scrollAnchor.addEventListener('click', function(event) {
                event.preventDefault();
                scroll(0, 0);
            }, false);

            // Toggle scroll anchor.
            window.addEventListener('scroll', debounce(function(event) {
                var top = (window.pageYOffset || document.scrollTop) - (document.clientTop || 0);

                scrollAnchor.style.display = top > 50 ? 'block' : 'none';
            }, 15), false);

        })();
    </script>

    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
              })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-60888769-2', 'auto');
        ga('send', 'pageview');
    </script>

</body>
</html>
gracebrownecodes commented 8 years ago

Testing in the VPN and modifying the client request method, it appears to fail every time when only the query parameter is set to json and on the third try when only the accept header is set to json and on the third try when both are set.

gracebrownecodes commented 8 years ago

Fixed by updating the deployed data-models-service instance.