Pesquisar

お知らせ
· 2025年5月7日

Winners of the Code Your Way to InterSystems READY 2025

Hi Community,

A huge thank you to everyone who participated in the Code Your Way to InterSystems READY 2025 challenge! We enjoyed watching your videos and checking out your projects. And now it's time to announce the winners! 

🥇 1st place, a pass and a hotel accommodation go to @Shawntelle Madison-Coker for her wp-iris-project app

🥈 2nd place and a pass go to @Kurro Lopez for his Iris-nator app

🥉 3rd place and a pass go to @Oliver Wilms for his jupyter-for-money app

Our sincerest congratulations to our winners and we look forward to seeing you at the InterSystems Ready 2025!

3 Comments
ディスカッション (3)2
続けるにはログインするか新規登録を行ってください
質問
· 2025年5月7日

How to prevent reentrancy inside same process ?

I use the following code to protect some code for being called by multiple processes at same time :

lock +^TEMP("FOO"):0 //don't wait
quit:'$test
//critical section
//...
lock -^TEMP("FOO")

This works between processes but it does not prevent the same process entering critical section twice.

How to do that, is there any lock option ? I would like it to behave as the lock in C# or Java.

It's OK for me to use something else than LOCK instruction (eg : signals)

8 Comments
ディスカッション (8)2
続けるにはログインするか新規登録を行ってください
ディスカッション (0)2
続けるにはログインするか新規登録を行ってください
記事
· 2025年5月6日 13m read

IRIS iRacing

 Hello IRIS Fans and Welcome to IRIS iRacing!

Here were going to take 3 laps of your time and demonstrate how I wired up my Racing SIM to IRIS for "As Real Time as It Gets" Metrics reporting.  I missed the window for the contest, which happens quite often, but I still ended up 3rd I think in the demo race in the video below.


Technical Salad

Below are the technical ingredients for this demonstration for a salad you can post on Instragram.

 
User.iRacing.cls


Dont forget to do a:

set tSC = ##class(SYS.Monitor.SAM.Config).AddApplicationClass("User.iRacing", "USER")

Then you should see your new metrics on the /api/monitor/metrics endpoint.


Notable here is my python setup on Windows:

cpf

[config]
LibPath=
MaxServerConn=1
MaxServers=2
Path=
PythonPath=c:\Python\Python313\python.exe
PythonRuntimeLibrary=C:\Python\Python313\python313.dll
PythonRuntimeLibraryVersion=3.13
UUIDv1RandomMac=0
bbsiz=-1
console=,


iris_site.py
 

def set_site_path(platform_name):
    sys.path = sys.path + __sitegetsitepackages(['C:\\Python\Python313'])    
    sys.path = sys.path + ["C:\\Python\Python313\\Lib"]

Racing SIM

Below is the SIM specifications, complete with Driver.

Gluing it all together, we have a rolling SIM emitting, scraping and serving up iRacing metrics suitable for real time display.

As Real Time as It Gets

The excuse I made for myself to derive some real value of sorts out of this was I have always wanted to be as agressive as possible with data reporting from the source to the exporter, clear through the Prometheus Scrape and the eventual dashboard.  The python sdk is wicked fast, as it reads from a memory mapped file while in session, and the other components can be configured to be agressive, but just are not by default and took some edits and daemon reloads.

In order to make this work, I found the following tweaks for necessary:

grafani.ini

min_refresh_interval = 1s

prometheus.yml
1s scrape
 

  - job_name: 'iracing'     # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 1s
    scrape_timeout: 1s     # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    static_configs:
      - targets: ['192.168.1.193:52773']
    metrics_path: '/api/monitor/metrics'

Dashboard

Newly added refresh rate can be added, and "Refresh Live Dashboards"  should be enabled.


At rest it doesnt look like much, as its designed to be real time, but a screenshot is in order to see the 5 panels.

 
Grafana Dash



Demo

The video shows us putting the Dashboard and scraping to work in a quick 3 lap shootout at Darlington Motor Speedway.

🏆 This is considered an InterSystems Best Practice

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
質問
· 2025年5月6日

Troubleshooting REST Operation

I am trying to replicate a REST call that I am able to make via a Postman call within a EnsLib.REST.GenericOperation.

It's been a while since I have messed around with trying to make external REST calls. When I execute my REST call, tSC is coming back with an error and I am trying to pinpoint why. I tried turning on ISCLOG = 5 but when calling the REST Operation from the Testing tool it is not logging anything to the ISC log.

How do we see the RAW request being sent out to verify that my request is formatted properly? tSC is coming back with an error as the message displayed in the error is "Error in sending request to server"

Method PostSearchPerson(pRequest As COM.REST.Msg.Request.PostSearchPerson.PostSearchPersonRequest, Output pResponse As COM.REST.Msg.Response.PostSearchPerson.PostSearchPersonResponse) As %Status

{

    #dim tSC As %Status = $$$OK

    set tHTTPRequest = ##class(%Net.HttpRequest).%New()

    set tHTTPRequest.SSLConfiguration = ..Adapter.SSLConfig

    set tHTTPRequest.Https = 1

    set tHTTPRequest.WriteRawMode = 1

    set tHTTPRequest.Port = ..Adapter.HTTPPort

    do tHTTPRequest.SetHeader("Host", ..Adapter.HTTPServer)

    Do tHTTPRequest.SetHeader("Accept-Encoding","application/json")

    Do tHTTPRequest.SetHeader("Content-Type","application/json")

    Do tHTTPRequest.SetHeader("api-key",..ApiKey)

    do tHTTPRequest.EntityBody.Write()

    do tHTTPRequest.OutputHeaders()

    set tRequest = ##class(%DynamicObject).%New()

    set tRequest.searchString = pRequest.searchString

    set tPayload = tRequest.%ToJSON()



    set tURL=..Adapter.URL_"/persons/search"

    set tSC = tHTTPRequest.EntityBody.Write(tPayload)

    set tHTTPResponse = ##class(%Net.HttpResponse).%New()

    set tSC = ..Adapter.SendFormDataArray(.tHTTPResponse, "POST", tHTTPRequest, tURL, tPayload)

    if $$$ISERR(tSC) {

        set tSC = $$$ERROR($$$GeneralError, "Error in sending request to the server")

        quit tSC

    }

    set responseData = {}.%FromJSON(tHTTPResponse.Data)

    set pResponse = ##class(COM.REST.Msg.Response.PostSearchPerson.PostSearchPersonResponse).%New()

    set tSC =  pResponse.%JSONImport(responseData)



   quit tSC

}

Thanks

3 Comments
ディスカッション (3)2
続けるにはログインするか新規登録を行ってください