Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json.decoder.JSONDecodeError when using glmScore #169

Closed
gygabyte017 opened this issue Nov 8, 2023 · 4 comments
Closed

json.decoder.JSONDecodeError when using glmScore #169

gygabyte017 opened this issue Nov 8, 2023 · 4 comments

Comments

@gygabyte017
Copy link

Hi, I'm running this action:

cas.regression.glmScore(
            restore=dict(name=self.model_table),
            table=dict(
                name=prepared_table,
                groupby="GROUPID",
                where=(
                    "TRAIN_START <= DATE <= TRAIN_END"
                    if partition == "train"
                    else "TEST_START <= DATE <= TEST_END"
                ),
            ),
            casOut=dict(name=fitted_table, replace=True),
            copyVars="ALL",
            pred="PREDICT",
            resid="ERROR",
        )

The action on cas completes successfully, but swat dies reading the response:

json.decoder.JSONDecodeError: Expecting value: line 79 column 29 (char 2344)

I debugged the line where it happens, method invoke of connection.py:

        try:
            txt = a2u(res.text, 'utf-8')
            self._results = json.loads(txt, strict=False)  # HERE
        except Exception:
            sys.stderr.write(res.text)
            sys.stderr.write('\n')
            raise

I extracted the txt content to see what is wrong, here's the txt:

{
  "changedResources": 
    [
      "tables"
    ],
  "disposition": 
    {
      "debugInfo": null,
      "formattedStatus": null,
      "reason": "OK",
      "severity": "Normal",
      "statusCode": 0
    },
  "log": "NOTE: Executing action 'regression.glmScore'.\nNOTE: Action 'regression.glmScore' used (Total process time):\nNOTE:       real time               1.468916 seconds\nNOTE:       cpu time                6.038826 seconds (411.11%)\nNOTE:       total nodes             13 (1248 cores)\nNOTE:       total memory            8.40T\nNOTE:       memory                  2.46G (0.03%)\nNOTE:       bytes moved             43.60M\n",
  "logEntries": 
    [
      {
        "level": "info",
        "message": "NOTE: Executing action 'regression.glmScore'."
      },
      {
        "level": "info",
        "message": "NOTE: Action 'regression.glmScore' used (Total process time):"
      },
      {
        "level": "info",
        "message": "NOTE:       real time               1.468916 seconds"
      },
      {
        "level": "info",
        "message": "NOTE:       cpu time                6.038826 seconds (411.11%)"
      },
      {
        "level": "info",
        "message": "NOTE:       total nodes             13 (1248 cores)"
      },
      {
        "level": "info",
        "message": "NOTE:       total memory            8.40T"
      },
      {
        "level": "info",
        "message": "NOTE:       memory                  2.46G (0.03%)"
      },
      {
        "level": "info",
        "message": "NOTE:       bytes moved             43.60M"
      }
    ],
  "metrics": 
    {
      "cpuSystemTime": 2.72476,
      "cpuUserTime": 3.314066,
      "dataMovementBytes": 45716928,
      "elapsedTime": 1.468916,
      "involuntaryContextSwitches": 0,
      "ioPageFaults": 0,
      "ioPageReclaims": 0,
      "ioReadBlocks": 0,
      "ioReadBytes": 0,
      "ioReadCalls": 0,
      "ioReadFaults": 0,
      "ioWriteBytes": 0,
      "ioWriteBytesCancelled": 0,
      "ioWriteCalls": 0,
      "memory": 2640917792,
      "memoryQuota": 12071313408,
      "osMemory": 3574169600,
      "systemCores": 1248,
      "systemMemory": 0,
      "systemNodes": 13,
      "systemTotalMemory": 9231714910208,
      "voluntaryContextSwitches": 0
    },
  "results": 
    {
      "keyedList": 
        {
          "$ByGroup.Event": CASValueList@0xa0cb2ec0,
          "OutputCasTables": CASResultsTable@0xcf649660
        },
      "list": 
        [
          {
            "BeginByGroup ": 1
          },
          {
            "BeginByGroup ": 2
          },
          {
            "BeginByGroup ": 3
          },
          {
            "BeginByGroup ": 4
          },
          {
            "BeginByGroup ": 5
          },
          {
            "BeginByGroup ": 6
          },
          {
            "BeginByGroup ": 7
          },
          {
            "BeginByGroup ": 8
          },
          {
            "BeginByGroup ": 9
          },
          {
            "BeginByGroup ": 10
          },
          {
            "BeginByGroup ": 11
          },
          {
            "BeginByGroup ": 12
          },
          {
            "BeginByGroup ": 13
          },
          {
            "BeginByGroup ": 14
          },
          {
            "BeginByGroup ": 15
          },
          {
            "BeginByGroup ": 16
          },
          {
            "BeginByGroup ": 17
          },
          {
            "BeginByGroup ": 18
          },
          {
            "BeginByGroup ": 19
          },
          {
            "BeginByGroup ": 20
          },
          {
            "BeginByGroup ": 21
          },
          {
            "BeginByGroup ": 22
          },
          {
            "BeginByGroup ": 23
          },
          {
            "BeginByGroup ": 24
          },
          {
            "BeginByGroup ": 25
          },
          {
            "BeginByGroup ": 26
          },
          {
            "BeginByGroup ": 27
          },
          {
            "BeginByGroup ": 28
          },
          {
            "BeginByGroup ": 29
          },
          {
            "BeginByGroup ": 30
          },
          {
            "BeginByGroup ": 31
          },
          {
            "BeginByGroup ": 32
          },
          {
            "BeginByGroup ": 33
          },
          {
            "BeginByGroup ": 34
          },
          {
            "BeginByGroup ": 35
          },
          {
            "BeginByGroup ": 36
          },
          {
            "BeginByGroup ": 37
          },
          {
            "BeginByGroup ": 38
          },
          {
            "BeginByGroup ": 39
          },
          {
            "BeginByGroup ": 40
          },
          {
            "BeginByGroup ": 41
          },
          {
            "BeginByGroup ": 42
          },
          {
            "BeginByGroup ": 43
          },
          {
            "BeginByGroup ": 44
          },
          {
            "BeginByGroup ": 45
          },
          {
            "BeginByGroup ": 46
          },
          {
            "BeginByGroup ": 47
          },
          {
            "BeginByGroup ": 48
          },
          {
            "BeginByGroup ": 49
          },
          {
            "BeginByGroup ": 50
          },
          {
            "BeginByGroup ": 51
          },
          {
            "BeginByGroup ": 52
          },
          {
            "BeginByGroup ": 53
          },
          {
            "BeginByGroup ": 54
          },
          {
            "BeginByGroup ": 55
          },
          {
            "BeginByGroup ": 56
          },
          {
            "BeginByGroup ": 57
          },
          {
            "BeginByGroup ": 58
          },
          {
            "BeginByGroup ": 59
          },
          {
            "BeginByGroup ": 60
          },
          {
            "BeginByGroup ": 61
          },
          {
            "BeginByGroup ": 62
          },
          {
            "BeginByGroup ": 63
          },
          {
            "BeginByGroup ": 64
          },
          {
            "BeginByGroup ": 65
          },
          {
            "BeginByGroup ": 66
          },
          {
            "BeginByGroup ": 67
          },
          {
            "BeginByGroup ": 68
          },
          {
            "BeginByGroup ": 69
          },
          {
            "BeginByGroup ": 70
          },
          {
            "BeginByGroup ": 71
          },
          {
            "BeginByGroup ": 72
          },
          {
            "BeginByGroup ": 73
          },
          {
            "BeginByGroup ": 74
          },
          {
            "BeginByGroup ": 75
          },
          {
            "BeginByGroup ": 76
          },
          {
            "BeginByGroup ": 77
          },
          {
            "BeginByGroup ": 78
          },
          {
            "_ctb": true,
            "attributes": 
              {
                "Action": 
                  {
                    "type": "string",
                    "value": "glmScore"
                  },
                "Actionset": 
                  {
                    "type": "string",
                    "value": "regression"
                  },
                "CreateTime": 
                  {
                    "type": "double",
                    "value": 2015070420.84411
                  },
                "TEMPLATE": 
                  {
                    "type": "string",
                    "value": "CAS.Common.OutputCasTables"
                  }
              },
            "label": "",
            "name": "OutputCasTables",
            "rows": 
              [
                [
                  "CASUSER(xxx)",
                  "w2ce7af693cd4a35b3f88a08f03be1d1",
                  "",
                  227916,
                  25
                ]
              ],
            "schema": 
              [
                {
                  "attributes": 
                    {
                    },
                  "format": "",
                  "label": "CAS Library",
                  "name": "casLib",
                  "type": "string",
                  "width": 26
                },
                {
                  "attributes": 
                    {
                    },
                  "format": "",
                  "label": "Name",
                  "name": "Name",
                  "type": "string",
                  "width": 32
                },
                {
                  "attributes": 
                    {
                    },
                  "format": "",
                  "label": "Label",
                  "name": "Label",
                  "type": "string",
                  "width": 0
                },
                {
                  "attributes": 
                    {
                    },
                  "format": "",
                  "label": "Number of Rows",
                  "name": "Rows",
                  "type": "int",
                  "width": 8
                },
                {
                  "attributes": 
                    {
                    },
                  "format": "",
                  "label": "Number of Columns",
                  "name": "Columns",
                  "type": "int",
                  "width": 8
                }
              ],
            "title": "Output CAS Tables"
          }
        ]
    },
  "status": 0
}

The deconding error appears to be around these lines:

        {
          "$ByGroup.Event": CASValueList@0xa0cb2ec0,
          "OutputCasTables": CASResultsTable@0xcf649660
        },

In fact, that's not a valid json value. How can this be solved?

Details:

  • python 3.10
  • swat 1.13.3
  • viya 2023.05

Thank you

@bkemper24
Copy link
Contributor

Thanks very much for the terrific debugging effort !! A fix for the issue is being investigated.

@gygabyte017
Copy link
Author

Hi @bkemper24 is there any update about this? With latest viya versions (2023.05 up to 2023.12 so far I have been testing) there are plenty of cas actions returning an invalid json file which make swat unusable with HTTP protocol.

@bkemper24
Copy link
Contributor

I was able to recreate what appeared to be the problem you were hitting using the glmScore action. The issue was a CAS server side issue. The fix ( for the issue I was seeing ) went into 2023.12. I am currently not seeing any more json decoder issues, if you are still seeing problems with 2023.12, could you please give me some examples of the actions you are running that are hitting the problem so I can look into it further ?

@gygabyte017
Copy link
Author

You're right, actually I tested up to 2023.11 (the scheduled update on our system was delayed so I was mistaken).
Now we are on 2023.12, and testing again I confirm the issue is fixed.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants