@@ -81,52 +85,6 @@ After this, you find the list of available demo apps in the (generated) README f
Most demo apps require CII Services be running on your host or on another host => Check that the related CII Services (e.g. config service for a a config demo app) are accessible: see [How-to start/stop CII Services](#how-to-start-stop-cii-services)
If disk usage is above 95%, elasticsearch goes into read-only mode, and creating new datapoints is not possible any more. To remove old content from the database, it is first necessary to create some free space on the disk (since the database needs space to perform deletetion-operations), then unlock the database, and then remove unnecessary old content from it.
In general, due to the many code generation steps taking place, your freedom in ICD file naming is limited.
The actual stalling comes from a failed MAL-communication with the CII Internal Configuration System, which likely is not running. Setting the timeout for the CiiConfigClient is therefore the thing to do. Note that the properties file (aka. "deployment config") takes precedence and will, if they overlap, overrule the programmatic (aka. "developer config") settings.
For more information, see also: [KB: PYBIND errors \[ICD waf build\]](onenote:#KB%20PYBIND%20errors%20[ICD%20waf%20build]§ion-id={F524F9BE-F51D-4A01-9976-93359FCC4966}&page-id={0FEE4FB9-C58B-4E8A-A276-2EC4367CFB30}&end&base-path=https://europeansouthernobservatory.sharepoint.com/sites/ELT_Control/SiteAssets/ELT_Control%20Notebook/Documentation/ELT%20Control%20KnowledgeBase.one)
\[3\]<https://gitlab.eso.org/cii/srv/cii-srv/-/blob/master/oldb-client/cpp/oldb/src/provider/ciiOldbLocalFileProvider.hpp>*\[Note: not before DevEnv 3.4\]*
File "/home/eltdev/MODULES/test/app.py", line 94, in instantiateDP
except CiiOldbPyB.CiiOldbDpExistsException:
NameError: name 'CiiOldbPyB' is not defined
```
The cpp compiler runs out of memory and crashes. You can see the effect by running htop in a separate terminal, all memory (including swap space) is consumed by the g++ compiler, which consequently crashes.
**Solution**
_Memory needed for building a given ICD module_
You were mislead by the first backtrace: the exception name in the backtrace is not what you should catch.
There is a base load that is the same for all ICD modules. On top of that, the ICD file contents determine how much memory is needed to build the module.
In your code, replace "**CiiOldbPyB**" with "**elt.oldb**":
_Rule of Thumb_
```
try:
....
except elt.oldb.CiiOldbDpExistsException as e:
```
| MAL version | Base Load | Mem per ICD-Struct |
| --- | ---- | ---- |
| MAL 1.x | 650 MB (2/3 GB) | 320 MB (1/3 GB) |
| MAL 2.0 | 650 MB (2/3 GB) | 110 MB (1/8 GB) |
For completeness - do no forget this statement:
Thus, if your biggest ICD contains 20 structs, building under MAL 1.x will require around 7 GB of available free memory.
_Measuring_
Record metrics of the ICD build with this time-command:
```
import elt.oldb
```
$ alias time='TIME="real\t%E\nmem\t%Mk\ncpu\t%P\npf\t%F" time'
$ time waf build
**Background**
[...]
real 10:28.19
mem 7206676k
cpu 765%
pf 166
```
The CII Python API is mostly a binding to the CII C++ API.
- If the build crashes, the time-command's output will not be fully reliable (the real memory need is higher than what the output shows).
- High page fault counts (`pf 1168635`) generally indicate you should reduce the module's footprint, see Solutions below.
The CiiOldbPyB.CiiOldbDpExistsException is the original binding class.
More info is available at [ECII-109](https://jira.eso.org/browse/ECII-109)
This binding class is re-exported under the name elt.oldb.CiiOldbDpExistsException.
The elt.oldb module internally loads the C++ binding module CiiOldbPyB. So both are the same exception.
**Solution 1: Decrease the module's footprint**
Nonetheless, you should use the re-exported name, not the original name in your application. We discourage the use of the original name because the structure of the CiiOldbPyB module is more "chaotic" and not equivalent to elt.oldb.
1. Remove unnecessary middlewares
Unfortunately, in the backtraces you will always see the original name instead of the re-exported name.
Use the `xyz_disabled` options:
```python
fromwtoolsimportmodule
# Disable OPCUA and DDS, since not part of this interface.
This question was originally asked in [ECII-422](https://jira.eso.org/browse/ECII-422).
2. Reduce build parallelism
By default the build system uses all cores on the host. Less parallelism means less memory consumers during the build. This is controlled by the waf `-j` option.
As a rough estimate, each waf build task will consume around 2 GB RAM, so on a 12 core host with 16 GB RAM, a parallelism of 8 may be a good choice. Try different numbers of cores and use the output from the time-command (see above) to find an optimum between real, page faults, and cpu.
Trying to use the OLDB on DevEnv 3.2.0, I'm getting this error:
Reduce the memory need by splitting the big ICDs up into 2 or more smaller ICD modules.
**Solution 2: Increase the available memory**
1. Find RAM consumers and stop them, at least temporarily. For example, ElasticSearch uses a significant amount of RAM: `sudo cii-services stop elasticsearch`
This fails because the datapoint "already exists":
```
2021-06-22T11:01:33.003+0000, ERROR, CiiOldbRedisDataPointProvider/140709706681216, Data point uri: cii.oldb:/tcs/hb/tempser3 in Redis already exists.
```
In response, my application skips the creation step, and wants to use the reportedly existing datapoint.
I am certain that my ICD will never be used over OPC UA. Nonetheless, the ICD-compilation builds OPC UA mappings for my ICD. This is unnecessarily extending the compilation time for my application.
However, when doing this, I get the error "Datapoint doesn't exist".
**Solution**
Likewise, when I run the oldb-gui database browser, it does not show this data point in the OLDB.
By default the ICD-compilation builds mappings for all middlewares. But it is possible to exclude certain middleware mappings from compilation, which will reduce compilation time. You do this by passing mal options to the icd-generator.
**Variant 2 of the Problem**
**Example**
I try to access an OLDB datapoint, and I see two errors like this:
wscript
```
Target configuration does not exist: Failed to retrieve configuration from elastic search: Configuration
[…]
elt.oldb.exceptions.CiiOldbDpExistsException: Data point cii.oldb:/alarm/alarm/device/motor/input_int_dp_alarm already exisits.
- opcua_disabled = if True, disable OPCUA middleware generation
I try to delete an OLDB datapoint and I see an error like this:
- dds_disabled = if True, disable DDS middleware generation
```
CiiOldbPyB.CiiOldbException: De-serialization error:sizeof(T)\*count is greater then remaining
```
- zpb_disabled = if True, disable ZEROMQ middleware generation
Go directly to Solution 2 below.
**Background**
The two errors are contradicting.
Datapoints are stored in two databases: a document-database (permanent store) for its metadata, and a key-value-database (volatile store) for its current value. The above symptoms indicate that the two databases are out-of-sync, meaning the datapoint exists only "half".
If the above didn't help, find out which "half" of the datapoint exists:
The -fvar-tracking-assignments is automatically enabled by GCC when optimizations are enabled.
1. The current value exists, and the metadata is missing. This is the case when upgrading DevEnv/CII without deleting the Redis cache.
There is a limit on how many variables can be tracked by the compiler. The warning tells you that more vars would need to be tracked than what's supported.
Run the following command:
You can disable the tracking manually with -fno-var-tracking-assignments.
Note: enter a search-expression matching the datapoint URI, in the example this is "tempser3".
There are two easy ways to do it on the overall project.
**Solution A**
```
# confirm that this is the cause of the problem
redis-cli KEYS *tempser3*
Export CXXFLAGS=-fno-var-tracking-assignments
```
If the command is showing the problematic key, we run a similar command to remove that key from the store:
And then rerun “waf configure” and continue with the build.
Note: you have to have the exported variable each time you do a “waf configure” as that is the point at which such flags are saved
**Solution B**
If you want it to be inside the project then put the flags fixed inside your project, so in the top level wscript (where you define the project) add this configure section before the project declaration:
```
# if so, delete the offending datapoint
redis-cli --scan --pattern *tempser3* | xargs redis-cli del
2. The metadata exists, and the current value is missing
Update: As of [ECII-303](https://jira.eso.org/browse/ECII-303), this should no longer be necessary, since the OLDB will make an attempt to automatically re-instate the current value that is missing.
**Solution 3**
If none of the above helped, another possibility is to clean up the metadata.
WARNING: This is an invasive operation. It deletes all datapoints in the OLDB.
```
# Clean up the OLDB databases
config-initEs.sh
oldb-initEs
redis-cli flushall
sudo cii-services stop config
sudo cii-services start config
```
If you are dealing with a multi-user oldb ("role_groupserver", meaning it serves an OLDB to a team of developers), after executing the above commands you need to additionally execute (with privileges):
I am certain that my ICD will never be used over OPC UA. Nonetheless, the ICD-compilation builds OPC UA mappings for my ICD. This is unnecessarily extending the compilation time for my application.
**Solution**
By default the ICD-compilation builds mappings for all middlewares. But it is possible to exclude certain middleware mappings from compilation, which will reduce compilation time. You do this by passing mal options to the icd-generator.
**Example**
wscript
Trying to send a msg, I get the following error message from CII:
[libprotobuf ERROR google/protobuf/message_lite.cc:121] Can't parse message of type "generated.zpb.fcfif.StdCmds_Request" because it is missing required fields: data.Setup.payload[0].piezoData.input
```
The available options are:
- opcua_disabled = if True, disable OPCUA middleware generation
- dds_disabled = if True, disable DDS middleware generation
- zpb_disabled = if True, disable ZEROMQ middleware generation
Trying to send a msg, I get the following error message from CII:
```
[libprotobuf ERROR google/protobuf/message_lite.cc:121] Can't parse message of type "generated.zpb.fcfif.StdCmds_Request" because it is missing required fields: data.Setup.payload[0].piezoData.input
```
My ICD definition looks like this
My ICD definition looks like this
```xml
<enumname="PiezoInput">
...
...
@@ -917,63 +728,10 @@ Your code does not work since you do not use union instance provided by the pare
This issue was first described in [ECII-154](https://jira.eso.org/browse/ECII-154)
You are intending to read a config from the local config database ("localdb"), but you see an error message like this.
```
elt.config.exceptions.CiiConfigNoTcException: Target configuration does not exist: Failed to retrieve configuration from elastic search: Configuration cii.config://*/supervisoryapp/TrkLsvDeploy on the remote db was not found
at elt.config.client.ConfigRemoteDatabase.retrieveConfig(ConfigRemoteDatabase.java:191)
at elt.config.client.CiiConfigClient.retrieveConfig(CiiConfigClient.java:354)
at elt.config.client.CiiConfigClient.retrieveConfig(CiiConfigClient.java:310)
at trkLsv.DataContext.loadConfig(DataContext.java:324)
at trkLsv.DataContext.<init>(DataContext.java:190)
at trkLsv.TrkLsv.go(TrkLsv.java:72)
at trkLsv.TrkLsv.main(TrkLsv.java:41)
Caused by: elt.error.icd.CiiSerializableException
at elt.config.service.client.icd.zpb.ServiceClientApiInterfaceAsyncImpl.processRequest(ServiceClientApiInterfaceAsyncImpl.java:73)
at elt.mal.zpb.rr.ClientAsyncImpl.events(ClientAsyncImpl.java:261)
at org.zeromq.ZPoller.dispatch(ZPoller.java:537)
at org.zeromq.ZPoller.poll(ZPoller.java:488)
at org.zeromq.ZPoller.poll(ZPoller.java:461)
at elt.mal.zpb.ZpbMal.processThread(ZpbMal.java:459)
at elt.mal.zpb.ZpbMal.lambda$new$0(ZpbMal.java:119)
at java.lang.Thread.run(Thread.java:748)
```
**Solution A**
Your local file may be invalid (e.g. illegal format, or doesn't match the config class definition).
Look at the content of your local config database, e.g. with
```
$ find $INTROOT/localdb
```
and correct the file in place, or fix the source yaml and then redeploy it from source to the localdb.
**Background**
You may have a malformed json file in your local db, which the config service failed to read.
Because of the use the location wildcard "\*" in your code (in "cii.config://\*/supervisoryapp/TrkLsvDeploy"),
the config service has consequently tried to load the config from the remote config database, where no such config exists.
To that end, the error message is misleading, and should be improved (ticket [ECII-208](https://jira.eso.org/browse/ECII-208)).
at elt.mal.zpb.ps.ZpbSubscriber.requireMoreFrames(ZpbSubscriber.java:82)
at elt.mal.zpb.ps.ZpbSubscriber.events(ZpbSubscriber.java:114)
```
void elt.log.CiiLogManager.setLogLevel(
final String loggerName, final org.apache.logging.log4j.Level level);
void elt.log.CiiLogManager.setLogLevel(
org.apache.logging.log4j.Logger logger, final org.apache.logging.log4j.Level level)
**Background**
The first warning message indicates that your client has received a piece of data (= MAL entity type) on a channel that should not carry such data. This means you are running two publishers, publishing different types of data, on the same channel.
elt.mal.SchemeNotSupportedException: middleware not supported
```
while in fact you have only one XML file in your ICD directory.
**Solution**
Check the file name of your ICD file:
make sure it starts with an uppercase letter.
**Solution A**
**Background**
In your code, you've misspelled the middleware name, e.g. "opc" instead of "opcua"
The error message is misleading (will be improved, [ECII-426](https://jira.eso.org/browse/ECII-426)).
**Solution B**
The code generator for malicd_topics fails when the ICD file name starts with lowercase.
The middleware is supported in fact, but failed to load.
For more information, see also: [KB: PYBIND errors \[ICD waf build\]](onenote:#KB%20PYBIND%20errors%20[ICD%20waf%20build]§ion-id={F524F9BE-F51D-4A01-9976-93359FCC4966}&page-id={0FEE4FB9-C58B-4E8A-A276-2EC4367CFB30}&end&base-path=https://europeansouthernobservatory.sharepoint.com/sites/ELT_Control/SiteAssets/ELT_Control%20Notebook/Documentation/ELT%20Control%20KnowledgeBase.one)
- E.g. in DDS, you are using a Qos profile xml file which has some illegal syntax inside.
...
...
@@ -1282,305 +1081,573 @@ For more information, see also: [KB: PYBIND errors \[ICD waf build\]](onenote:#K
Trying to build an ICD-module or MAL-application, the build takes a long time, and/or fails with an error message like this:
I'm using MAL-DDS, and I have two network cards (NICs) installed. MAL uses the wrong one, i.e. my network traffic goes into the "office" network, but should go into the "control" network.
```
g++: fatal error: Killed signal terminated program cc1plus
As multicast addresses are by definition not associated with hardware (ie they map to MAC addresses which have no corresponding Ethernet card), there is no means for the OS to resolve which NIC the IGMP subscription should be sent down. Thus the NIC must be specified, or the default is used (which is the office network).
Therefore, DDS allows you to specify which NIC you want to use for outgoing traffic.
**Background**
Therefore, this boils down to configuring DDS.
The cpp compiler runs out of memory and crashes. You can see the effect by running htop in a separate terminal, all memory (including swap space) is consumed by the g++ compiler, which consequently crashes.
**Solution**
_Memory needed for building a given ICD module_
1. Get the XML file shown in Solution #1 on this page:
There is a base load that is the same for all ICD modules. On top of that, the ICD file contents determine how much memory is needed to build the module.
By default the build system uses all cores on the host. Less parallelism means less memory consumers during the build. This is controlled by the waf `-j` option.
```
FASTRTPS_DEFAULT_PROFILES_FILE=\<path of XML file>
```
To build with only 4 cores:
` $ time waf -j4 build `
As a rough estimate, each waf build task will consume around 2 GB RAM, so on a 12 core host with 16 GB RAM, a parallelism of 8 may be a good choice. Try different numbers of cores and use the output from the time-command (see above) to find an optimum between real, page faults, and cpu.
The default set of compiler flags applied by the build system consume significant memory.
We recommend using "-O2 -flto -pipe" (_to be confirmed_) instead. This is how you pass custom compiler flags for your ICD-module:
This article covers integration of OPC/UA in CII MAL specifically for OPC/UA Data Access and Subscription profiles. OPC/UA method invocation is also supported in CII MAL but is not described in this article, likewise details of the Python (and Java) support are not provided. Only C++ is considered here.
In your project wscript:
~~~python
fromwtoolsimportproject
[...]
defconfigure(cnf):
cnf.env.CXXFLAGS_MALPYTHON='-O2 -flto -pipe'
[...]
~~~
OPC/UA communication middleware is exposed in CII MAL as either Publish/Subscribe or Request/Reply APIs.
4. Refactor your ICD
The XML ICD definition of types in CII is used to map sets of data points together that are read/written as a group.
Reduce the memory need by splitting the big ICDs up into 2 or more smaller ICD modules.
Each attribute in the defined type is connected to a corresponding data point in the OPC/UA data space via a URI. Thus the CII URI for a complex type will contain specific addresses of multiple nodes in the OPC/UA data space.
**Solution 2: Increase the available memory**
1. Find RAM consumers and stop them, at least temporarily. For example, ElasticSearch uses a significant amount of RAM: `sudo cii-services stop elasticsearch`
The CII MAL Pub/Sub API utilizes OPC/UA Data Access Reads and Writes, as well OPC/UA subscription. A Publisher will directly trigger an OPC DA write, while a Subscriber will work in one of two ways, depending on the type associated with the subscriber:
- If the subscribers CII URI contains only a single node (i.e. the XML ICD type contained only a single attribute) then the Subscriber will create an OPC/UA subscription on that data point. The subscription will trigger notification of updates to the data point node, which will then be queued for notification via the CII Subscriber API.
- If the Subscriber is using subscription, the opc.ps.outstandingPublishRequests property should not be zero (e.g. set it to 5), see the example code below. The reason is that the publish queue is used to store and send subscription notification events, and if the queue is small the even notifications may simply be dropped.
- If the subscriber CII URI contains multiple nodes (i.e. the XML ICD type contains multiple attributes) then the Subscriber launches a thread to perform periodic polling of data from the OPC/UA server. The rate is based on the properties passed in creating the subscriber. e.g.
As OPC/UA Data Access read and write essentially follow a synchronous request/reply pattern, CII MAL also provides this interface for OPC/UA clients.
The ICD is termed "virtual" in CII nomenclature as it does not require definition as an XML ICD using the service syntax, rather the same types defined for the Pub/Sub API may be used with a CII MAL OPC/UA Request/Reply.
This approach means OPC/UA Data Access read (and write) are synchronous, and may be called as needed by the application.
The first warning message indicates that your client has received a piece of data (= MAL entity type) on a channel that should not carry such data. This means you are running two publishers, publishing different types of data, on the same channel.
If disk usage is above 95%, elasticsearch goes into read-only mode, and creating new datapoints is not possible any more. To remove old content from the database, it is first necessary to create some free space on the disk (since the database needs space to perform deletetion-operations), then unlock the database, and then remove unnecessary old content from it.
The second warning and the error trace are just a consequence of the first warning.
When starting an application using the OLDB API, the following exception is received:
```
<date/time>, ERROR, CiiOldbFactory/140635105143296, Unexpected config exception occurred while retrieving configuration for cii.config://remote/oldb/configurations/oldbClientConfig What:Path oldb/configurations/oldbClientConfig, version -1 not found
terminate called after throwing an instance of 'elt::oldb::CiiOldbException'
what(): Unexpected config exception occurred while retrieving configuration for cii.config://remote/oldb/configurations/oldbClientConfig What:Path oldb/configurations/oldbClientConfig, version -1 not found
```
**Solution**
This can indicate that elasticSearch on the config/oldb server is not running, or has crashed.
Use cii-services command to check the status on the server where the (cii-internal) config is running.
Check your topics.xml file, and make sure each channel has its own exclusive topic name.
The actual stalling comes from a failed MAL-communication with the CII Internal Configuration System, which likely is not running. Setting the timeout for the CiiConfigClient is therefore the thing to do. Note that the properties file (aka. "deployment config") takes precedence and will, if they overlap, overrule the programmatic (aka. "developer config") settings.
\[3\]<https://gitlab.eso.org/cii/srv/cii-srv/-/blob/master/oldb-client/cpp/oldb/src/provider/ciiOldbLocalFileProvider.hpp>*\[Note: not before DevEnv 3.4\]*
pub:sys: Available MAL Flavours loaded: [dds, opc, zpb]
pub:config: sAddr=zpb://eltcii28:12333/Sample
pub:config: nSamp=100
pub:config: tSlow=100
Internal Error: org.eso.elt.mal.MalException: org.zeromq.ZMQException: Errno 48 : Address already in use
2021-06-22T11:01:33.003+0000, ERROR, CiiOldbRedisDataPointProvider/140709706681216, Data point uri: cii.oldb:/tcs/hb/tempser3 in Redis already exists.
```
In response, my application skips the creation step, and wants to use the reportedly existing datapoint.
However, when doing this, I get the error "Datapoint doesn't exist".
Likewise, when I run the oldb-gui database browser, it does not show this data point in the OLDB.
**Variant 2 of the Problem**
I try to access an OLDB datapoint, and I see two errors like this:
```
Target configuration does not exist: Failed to retrieve configuration from elastic search: Configuration
[…]
elt.oldb.exceptions.CiiOldbDpExistsException: Data point cii.oldb:/alarm/alarm/device/motor/input_int_dp_alarm already exisits.
```
**Reason**
Go directly to Solution 2 below.
The above code is trying, on host eltcii33, to publish with an endpoint eltcii28.
**Variant 3 of the Problem**
**Fix**
I try to delete an OLDB datapoint and I see an error like this:
On eltcii33, the endpoint must be eltcii33.
```
CiiOldbPyB.CiiOldbException: De-serialization error:sizeof(T)\*count is greater then remaining
```
Go directly to Solution 2 below.
**Background**
The two errors are contradicting.
Datapoints are stored in two databases: a document-database (permanent store) for its metadata, and a key-value-database (volatile store) for its current value. The above symptoms indicate that the two databases are out-of-sync, meaning the datapoint exists only "half".
**Solution 1**
There is a good chance you can delete the datapoint to clean up the situation (as of [ECII-303](https://jira.eso.org/browse/ECII-303)):
If the above didn't help, find out which "half" of the datapoint exists:
1. The current value exists, and the metadata is missing. This is the case when upgrading DevEnv/CII without deleting the Redis cache.
Run the following command:
Note: enter a search-expression matching the datapoint URI, in the example this is "tempser3".
```
# confirm that this is the cause of the problem
redis-cli KEYS *tempser3*
```
If the command is showing the problematic key, we run a similar command to remove that key from the store:
```
# if so, delete the offending datapoint
redis-cli --scan --pattern *tempser3* | xargs redis-cli del
```
2. The metadata exists, and the current value is missing
Update: As of [ECII-303](https://jira.eso.org/browse/ECII-303), this should no longer be necessary, since the OLDB will make an attempt to automatically re-instate the current value that is missing.
**Solution 3**
If none of the above helped, another possibility is to clean up the metadata.
WARNING: This is an invasive operation. It deletes all datapoints in the OLDB.
```
# Clean up the OLDB databases
config-initEs.sh
oldb-initEs
redis-cli flushall
sudo cii-services stop config
sudo cii-services start config
```
If you are dealing with a multi-user oldb ("role_groupserver", meaning it serves an OLDB to a team of developers), after executing the above commands you need to additionally execute (with privileges):
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import elt.oldb
>>> from elt.config import Uri
>>> oldb = elt.oldb.CiiOldbFactory.get_instance()
```
**Problem**
… and, to create a datapoint:
I'm using MAL-DDS, and I have two network cards (NICs) installed. MAL uses the wrong one, i.e. my network traffic goes into the "office" network, but should go into the "control" network.
>>> oldb.create_data_point_by_value (Uri("cii.oldb:/ccs/tst/tmp1"), "my text")
```
**Background**
… and, to read a datapoint:
As multicast addresses are by definition not associated with hardware (ie they map to MAC addresses which have no corresponding Ethernet card), there is no means for the OS to resolve which NIC the IGMP subscription should be sent down. Thus the NIC must be specified, or the default is used (which is the office network).
CiiOldbPyB.CiiOldbDpExistsException: The Data point cii.oldb:/root/test/xxxdp already exists.
```
**Background**
The -fvar-tracking-assignments is automatically enabled by GCC when optimizations are enabled.
There is a limit on how many variables can be tracked by the compiler. The warning tells you that more vars would need to be tracked than what's supported.
You can disable the tracking manually with -fno-var-tracking-assignments.
There are two easy ways to do it on the overall project.
**Solution A**
Therefore, I added a corresponding try-catch around my call:
```
Export CXXFLAGS=-fno-var-tracking-assignments
try:
...
except CiiOldbPyB.CiiOldbDpExistsException as e:
```
And then rerun “waf configure” and continue with the build.
Note: you have to have the exported variable each time you do a “waf configure” as that is the point at which such flags are saved
**Solution B**
When I run it, the try-catch doesn't work.
If you want it to be inside the project then put the flags fixed inside your project, so in the top level wscript (where you define the project) add this configure section before the project declaration:
Moreover, I now get two backtraces:
```
def configure(cnf):
Top Level Unexpected exception:
Traceback (most recent call last):
File "/home/eltdev/MODULES/test/app.py", line 91, in instantiateDP
This article covers integration of OPC/UA in CII MAL specifically for OPC/UA Data Access and Subscription profiles. OPC/UA method invocation is also supported in CII MAL but is not described in this article, likewise details of the Python (and Java) support are not provided. Only C++ is considered here.
**Background**
OPC/UA communication middleware is exposed in CII MAL as either Publish/Subscribe or Request/Reply APIs.
The CII Python API is mostly a binding to the CII C++ API.
The XML ICD definition of types in CII is used to map sets of data points together that are read/written as a group.
The CiiOldbPyB.CiiOldbDpExistsException is the original binding class.
Each attribute in the defined type is connected to a corresponding data point in the OPC/UA data space via a URI. Thus the CII URI for a complex type will contain specific addresses of multiple nodes in the OPC/UA data space.
This binding class is re-exported under the name elt.oldb.CiiOldbDpExistsException.
The elt.oldb module internally loads the C++ binding module CiiOldbPyB. So both are the same exception.
Nonetheless, you should use the re-exported name, not the original name in your application. We discourage the use of the original name because the structure of the CiiOldbPyB module is more "chaotic" and not equivalent to elt.oldb.
Unfortunately, in the backtraces you will always see the original name instead of the re-exported name.
This question was originally asked in [ECII-422](https://jira.eso.org/browse/ECII-422).
The CII MAL Pub/Sub API utilizes OPC/UA Data Access Reads and Writes, as well OPC/UA subscription. A Publisher will directly trigger an OPC DA write, while a Subscriber will work in one of two ways, depending on the type associated with the subscriber:
- If the subscribers CII URI contains only a single node (i.e. the XML ICD type contained only a single attribute) then the Subscriber will create an OPC/UA subscription on that data point. The subscription will trigger notification of updates to the data point node, which will then be queued for notification via the CII Subscriber API.
- If the Subscriber is using subscription, the opc.ps.outstandingPublishRequests property should not be zero (e.g. set it to 5), see the example code below. The reason is that the publish queue is used to store and send subscription notification events, and if the queue is small the even notifications may simply be dropped.
- If the subscriber CII URI contains multiple nodes (i.e. the XML ICD type contains multiple attributes) then the Subscriber launches a thread to perform periodic polling of data from the OPC/UA server. The rate is based on the properties passed in creating the subscriber. e.g.
As OPC/UA Data Access read and write essentially follow a synchronous request/reply pattern, CII MAL also provides this interface for OPC/UA clients.
### config not found on remote db [IntCfg]
The ICD is termed "virtual" in CII nomenclature as it does not require definition as an XML ICD using the service syntax, rather the same types defined for the Pub/Sub API may be used with a CII MAL OPC/UA Request/Reply.
This approach means OPC/UA Data Access read (and write) are synchronous, and may be called as needed by the application.
```cpp
namespacemal{
namespacerr{
namespaceda{
**Problem**
classDataAccess:public::elt::mal::rr::RrEntity{
public:
[...]
template<typenameT>
voidread(::elt::mal::ps::DataEntity\<T>&value){
readUnsafe(&value);
}
You are intending to read a config from the local config database ("localdb"), but you see an error message like this.
elt.config.exceptions.CiiConfigNoTcException: Target configuration does not exist: Failed to retrieve configuration from elastic search: Configuration cii.config://*/supervisoryapp/TrkLsvDeploy on the remote db was not found
at elt.config.client.ConfigRemoteDatabase.retrieveConfig(ConfigRemoteDatabase.java:191)
at elt.config.client.CiiConfigClient.retrieveConfig(CiiConfigClient.java:354)
at elt.config.client.CiiConfigClient.retrieveConfig(CiiConfigClient.java:310)
at trkLsv.DataContext.loadConfig(DataContext.java:324)
at trkLsv.DataContext.<init>(DataContext.java:190)
at trkLsv.TrkLsv.go(TrkLsv.java:72)
at trkLsv.TrkLsv.main(TrkLsv.java:41)
Caused by: elt.error.icd.CiiSerializableException
at elt.config.service.client.icd.zpb.ServiceClientApiInterfaceAsyncImpl.processRequest(ServiceClientApiInterfaceAsyncImpl.java:73)
at elt.mal.zpb.rr.ClientAsyncImpl.events(ClientAsyncImpl.java:261)
at org.zeromq.ZPoller.dispatch(ZPoller.java:537)
at org.zeromq.ZPoller.poll(ZPoller.java:488)
at org.zeromq.ZPoller.poll(ZPoller.java:461)
at elt.mal.zpb.ZpbMal.processThread(ZpbMal.java:459)
at elt.mal.zpb.ZpbMal.lambda$new$0(ZpbMal.java:119)
at java.lang.Thread.run(Thread.java:748)
```
**Solution A**
A test application showing its use is here:
Your local file may be invalid (e.g. illegal format, or doesn't match the config class definition).
You may have a malformed json file in your local db, which the config service failed to read.
When starting an application using the Config client API and the following exception is received:
```
<date/time>, ERROR, CiiOldbFactory/140635105143296, Unexpected config exception occurred while retrieving configuration for cii.config://remote/oldb/configurations/oldbClientConfig What:Path oldb/configurations/oldbClientConfig, version -1 not found
terminate called after throwing an instance of 'elt::oldb::CiiOldbException'
what(): Unexpected config exception occurred while retrieving configuration for cii.config://remote/oldb/configurations/oldbClientConfig What:Path oldb/configurations/oldbClientConfig, version -1 not found
```
Because of the use the location wildcard "\*" in your code (in "cii.config://\*/supervisoryapp/TrkLsvDeploy"),
*info*
This can indicate that elasticSearch on the config/oldb server is not running, or has crashed.
Use cii-services command to check the status on the server where the config is running.
the config service has consequently tried to load the config from the remote config database, where no such config exists.
To that end, the error message is misleading, and should be improved (ticket [ECII-208](https://jira.eso.org/browse/ECII-208)).