HELICS icon indicating copy to clipboard operation
HELICS copied to clipboard

Unable to create `MessageFederate` or `ValueFederate` from config json file in v3.0.0.alpha.2

Open kdheepak opened this issue 4 years ago • 6 comments

Screen Shot 2020-11-09 at 9 05 10 PM

I'm using HELICS v3.0.0.alpha.2 with the following filters.json file:

{
  "coreinit": "--autobroker",
  "corename": "the name of the filter federate core",
  "coretype": "inproc",
  "endpoints": [
    {
      "global": true,
      "name": "ept1",
      "type": "genmessage"
    },
    {
      "global": true,
      "name": "clonedest"
    },
    {
      "knownDestinations": "ept1",
      "name": "ept2",
      "subscriptions": "fed2/sub1",
      "type": "message2"
    }
  ],
  "filters": [
    {
      "info": "this is an information string for use by the application",
      "name": "filtername",
      "operation": "delay",
      "properties": {
        "name": "delay",
        "value": 0.2
      },
      "sourcetargets": "ept1"
    },
    {
      "name": "filtername2",
      "operation": "reroute",
      "properties": {
        "name": "newdestination",
        "value": "ept1"
      },
      "sourcetargets": [
        "filterFed/ept2"
      ]
    },
    {
      "cloning": true,
      "delivery": "ept2",
      "name": "filterClone",
      "properties": [
        {
          "name": "destination",
          "value": "ept1"
        },
        {
          "name": "source",
          "value": "ept1"
        }
      ]
    }
  ],
  "input_delay": 0,
  "max_iterations": 10,
  "name": "filterFed",
  "observer": false,
  "offset": 0.0,
  "only_transmit_on_change": false,
  "only_update_on_change": false,
  "output_delay": 0,
  "period": 1.0,
  "rollback": false,
  "source_only": false,
  "time_delta": 0.0,
  "uninterruptible": false
}

kdheepak avatar Nov 10 '20 04:11 kdheepak

I'm getting the same error with the following json when trying to create a ValueFederate:

{
  "coreinit": "--autobroker",
  "corename": "the name of the value federate core",
  "coretype": "inproc",
  "globals": [
    [
      "global1",
      "this is a global1 value"
    ],
    [
      "global2",
      "this is another global value"
    ]
  ],
  "input_delay": 0,
  "inputs": [
    {
      "key": "ipt2",
      "required": true,
      "target": "pub1",
      "type": "double"
    }
  ],
  "max_iterations": 10,
  "name": "valueFed",
  "observer": false,
  "offset": 0.0,
  "only_transmit_on_change": false,
  "only_update_on_change": false,
  "output_delay": 0,
  "period": 1.0,
  "publications": [
    {
      "global": true,
      "info": "this is an information string for use by the application",
      "key": "pub1",
      "type": "double",
      "unit": "m"
    },
    {
      "key": "pub2",
      "type": "double"
    }
  ],
  "rollback": false,
  "source_only": false,
  "subscriptions": [
    {
      "key": "pub1",
      "required": true
    },
    {
      "info": "this is an information string for use by the application",
      "key": "fedName/pub2",
      "shortcut": "pubshortcut"
    }
  ],
  "time_delta": 0.0,
  "uninterruptible": false
}

kdheepak avatar Nov 10 '20 04:11 kdheepak

The "coreinit" option was removed in @trevorhardy commit to reduce the overloads of parameters. It needs to be changed to "coreinitstring" I suppose we can have a discussion if "coreinit" or "coreinitstring" is most appropriate, but it won't work as is.

phlptp avatar Nov 10 '20 13:11 phlptp

Thanks! That resolved it! However, the error message here is really hard to understand. This is probably not straightforward to solve, but it would be nice if we can do a validation pass on the json and provide an error message that tell the user exact what is going on here.

kdheepak avatar Nov 10 '20 15:11 kdheepak

The error was unable to connect to broker. That seems clear enough.
Not sure how to interpret that the reason it didn't connect was the "coreinit" field was not used. try setting "strict_config_checking":true in the file and see what that does

phlptp avatar Nov 10 '20 15:11 phlptp

what would be the preferred way to warn for this? in this case "coreinit" is unused which is causing the issue. Should we use strict_config_checking to warn on unused fields? Should we pick up some common ones and specifically warn on them? Something else?

phlptp avatar Nov 10 '20 17:11 phlptp

@kdheepak or @phlptp: do we need to keep discussing this or should it be considered resolved?

trevorhardy avatar Dec 04 '21 00:12 trevorhardy

I think this is resolved

phlptp avatar Jan 18 '23 23:01 phlptp