Clear filter
Announcement
Anastasia Dyubaylo · Aug 26, 2022
Hey Developers,
New video is already on InterSystems Developers YouTube channel:
⏯ Using the Business Process Designer in InterSystems IRIS
See how to construct a new business process, which provides business logic and routing capabilities within an InterSystems production. Learn how to build a BPL business process using the Business Process Designer in the Management Portal. Also, try building one yourself using an InterSystems IDE.
Enjoy watching!
Announcement
Anastasia Dyubaylo · Aug 30, 2022
Hey Developers,
Meet the new video on InterSystems Developers YouTube channel:
⏯ Creating Complex Decision Logic with InterSystems IRIS
Using the graphical interface of the Business Rule Editor in InterSystems IRIS data platform, nontechnical users can set up business rules to better process records and untangle complex data.
Like and share! Very helpful and nice use of features. I appreciate the real-world use case and thorough explanation!
Announcement
Anastasia Dyubaylo · Jun 19, 2022
Hey Developers,
Join us for a discussion guide of current operational tasks to reduce storage and an overview of new features coming in InterSystems HealthShare 2021.2, including stream, database, and journal compression abilities:
⏯ InterSystems HealthShare Storage Footprint Reduction
🗣 Presenter: @Mark.Bolinsky, InterSystems Corporation Principle Technology Architect
Enjoy watching on InterSystems Developers YouTube channel! Hi @Mark.Bolinsky , this is very useful and helpful for our China custs, and we'd really appreciate if you could help do an article for this becoz we Chinese users cannot access Youtube. Thx a lot for your big favor!
Announcement
Angelo Bruno Braga · Mar 11, 2022
Hi Developers !
Welcome to our 🏆1st InterSystems Portuguese Tech Article Contest 🏆
Write an article about any topic related to InterSystems technologies from March 14 to April 14, 2022.
We're excited about your participation. Join now!
Build up a team and join sending the article made by the team. There will be a bonus for articles made by teams.
Prizes for everybody: All participants will receive a special prize!
Duration: from March 14 to April 14, 2022
Prizes
1. All are winners on our 1st InterSystems Portuguese Tech Article Contest! Any member that joins the contest will receive a special prize:
🎁 InterSystems - Developers Community termic bottle
2. Experts Awards – the articles will be judged by InterSystems experts:
🥇 1st place: iPad
🥈 2nd place: Gaming Chair
🥉 3rd place: JBL Gaming Headphone
3. Developers Community Award – article with the most likes. The winner will be able to choose one of the following prizes:
🎁 Alexa (echoDot 4)
🎁 Google Chromecast
🎁 Earphone Bluetooth Earbuds Basic Redmi Airdots 2 - Xiaomi
Important:
The author can only be awarded once per category (in total the author will win 2 prizes: one for Expert and one for the Community)
In the event of a tie, the number of votes of the experts for the tied articles will be considered as a tie-breaking criterion.
Who can participate?
Any Developer Community member, except for InterSystems employees. Create an account!
Contest Period
📝 March 14 - April 14: Publication of articles and voting time.
Publish an article(s) throughout this period. DC members can vote for published articles with Likes – votes in the Community award.
Note: The sooner you publish an article(s), the more time you will have to collect both Experts & Community votes.
🎉 April 25: Winners announcement.
What are the requirements?
❗️ Any article written during the contest period and satisfying the requirements below will automatically enter the competition:
The article must be in Portuguese
The article must be related to InterSystems technology
It should list the challenges encountered and/or the reason for choosing the theme.
It cannot be a translation of an article already published in other communities.
The article must be 100% new in the community.
Article size: >1,000 characters (links and codes are not counted towards character limit).
If the article is written in partnership, the names of the co-authors must be indicated and all must be members of the community. New community members must be registered: Create an account!
What to write about?
❗️ You can choose any tech topic related to InterSystems technology.
🎯 NEW BONUS: If your article is on the topic from the list of the proposed topics, you will receive a bonus of 5 Expert votes (vs 1st place selected by an Expert = 3 votes).
Here're some possible fields for choosing the article topic. These are just examples, you have the liberty to choose anything you want.
#
Topic
Details
1
Embedded Python Introduction
Use the new functionality available in IRIS 2021.2 that allows you to write SQL methods and procedures in Python.
2
How to do CI/CD with InterSystems IRIS
–
3
Change Data Capture with Kafka Connect
An example that shows how to set up Kafka Connect and export & import SQL data via the Kafka Connect JDBC connector.
4
Using %MDX and %KPI instead of Subject Area in IRIS Analytics
–
5
Exporting to Excel using Python
–
6
Integrating cloud services with productions
Ex.: MS Azure Cognitive Services or Amazon Rekognition.
7
Working with IKO (InterSystems Kubernetes Operator)
–
8
InterSystems on the cloud
Bringing the InterSystems Platform to the Cloud
9
High availability of InterSystems environments on K8S
Deploying microservices technology with InterSystems in high availability
10
Data Science shared workgroup setup with ECP
There is a data server and each data scientist has a compute node on their desktop. Show the data is available when disconnected and syncs when you re-connect.
11
Cloud connectors
Write an article on how to use cloud connectors to manage InterSystems IRIS applications on Amazon Webservice and use the connectors to access services.
Input and Output Adapters for S3 (Amazon Storage Service)
Output Adapter for Cloudwatch (Amazon Monitoring Services)
Output Adapter for SNS (Amazon Notification Service) for messaging.
12
HealthShare
How can the InterSystems HealthShare platform help institutions prevent disease and promote people's health?
13
IRIS for Health / FHIR
How can FHIR protocol accelerate healthcare application development?
14
IRIS for Health
How can a healthcare platform help institutions make decisions based on longitudinal patient information?
15
IAM – InterSystems API Manager
Using API Manager to improve service publishing
Note: Articles on the same topic from different authors are allowed.
Feel free to submit your topic ideas in the comments to this post.
🎯 EXTRA BÔNUS:
Format of the presentation of the content of the Article: besides publishing the article make an explanatory video (+ 1 vote)
The number of features used/described in the article (+ 1 vote)
Indication/participation of a person from outside the community in the co-authorship of the Article – with the aim of promoting/disseminating it to other professionals (+ 3 votes)
Article with the most comments (+ 2 votes)
Article by a new member in the community without partnership (+ 3 votes)
Presentation of the architecture (logical model) with the solution/representation of the explored theme (+1 vote)
We're waiting for your great articles!
Good luck! Go go go!!! Developers!
Don't miss the 1st InterSystems Portuguese Tech Article Contest !
Join the contest, make articles and win prizes!
Announcement
Raj Singh · Mar 30, 2022
InterSystems is pleased to announce version 2.0.0 of the Language Server for VS Code. The Language Server augments the VS Code ObjectScript extension to provide better syntax coloring, embedded documentation, code completion and more. Detailed information is available in the GitHub repo's README. Version 2.0.0 adds support for a number of new platform architectures including M1 Macs! It also reduces package size, improves SQL coloring, and fixes a number of other issues detailed in the CHANGELOG.
As always, if you already have the extension installed, VS Code should automatically update your extension when you restart or reload. If you're a new user, use these instructions to get started.
Announcement
Anastasia Dyubaylo · Apr 6, 2022
Hey Developers,
Good news! One more upcoming in-person event is nearby.
We're pleased to invite you to join "J On The Beach", an international rendezvous for developers and DevOps around Big Data technologies. A fun conference to learn and share the latest experiences, tips & tricks related to Big Data technologies, and, the most important part, it’s On The Beach!
🗓 April 27-29, 2022
📍Málaga, Spain
This year, InterSystems is a Gold Sponsor of the JOTB.
We're more than happy to invite you and your colleagues to our InterSystems booth for a personal conversation. As always, there will be some surprises on it... 😁
In addition, on the first day of the Conference @David.Reche and @Eduardo.Anglada will give a talk called "Captain Kirk, exoplanet found on route using Auto Machine Learning.
🎯 More details can be found at jonthebeach.com
Looking forward to seeing you soon!
Announcement
Anastasia Dyubaylo · Jul 11, 2022
Hey Community,
It's voting time! Let's cast your votes for the best applications in the InterSystems Full Stack Contest 2022:
🔥 VOTE FOR THE BEST APPS 🔥
How to vote? Details below.
Experts nomination:
InterSystems experienced jury will choose the best apps to nominate the prizes in the Experts Nomination. Please welcome our experts:
⭐️ @Andreas.Dieckow, Principal Product Manager⭐️ @Benjamin.DeBoe, Product Manager⭐️ @Robert.Kuszewski, Product Manager⭐️ @Raj.Singh5479, Product Manager⭐️ @Alexander.Koblov, Support Specialist⭐️ @Daniel.Kutac, Senior Sales Engineer⭐️ @Guillaume.Rongier7183, Sales Engineer⭐️ @Steve.Pisani, Senior Solution Architect⭐️ @Eduard.Lebedyuk, Senior Cloud Engineer⭐️ @Alexander.Woodhead, Technical Specialist⭐️ @Timothy.Leavitt, Development Manager ⭐️ @Jeffrey.Fried, Director of Product Management⭐️ @Evgeny.Shvarov, Developer Ecosystem Manager
Community nomination:
For each user, a higher score is selected from two categories below:
Conditions
Place
1st
2nd
3rd
If you have an article posted on DC and an app uploaded to Open Exchange (OEX)
9
6
3
If you have at least 1 article posted on DC or 1 app uploaded to OEX
6
4
2
If you make any valid contribution to DC (posted a comment/question, etc.)
3
2
1
Level
Place
1st
2nd
3rd
VIP Global Masters level or ISC Product Managers
15
10
5
Ambassador GM level
12
8
4
Expert GM level or DC Moderators
9
6
3
Specialist GM level
6
4
2
Advocate GM level or ISC Employees
3
2
1
Blind vote!
The number of votes for each app will be hidden from everyone. Once a day we will publish the leaderboard in the comments to this post.
The order of projects on the contest page will be as follows: the earlier an application was submitted to the competition, the higher it will be in the list.
P.S. Don't forget to subscribe to this post (click on the bell icon) to be notified of new comments.
To take part in the voting, you need:
Sign in to Open Exchange – DC credentials will work.
Make any valid contribution to the Developer Community – answer or ask questions, write an article, contribute applications on Open Exchange – and you'll be able to vote. Check this post on the options to make helpful contributions to the Developer Community.
If you changed your mind, cancel the choice and give your vote to another application!
Support the application you like!
Note: contest participants are allowed to fix the bugs and make improvements to their applications during the voting week, so don't miss and subscribe to application releases! Since the beginning of the voting we have the results:
Expert Nomination, Top 3
Kozo by @Sean.Connelly
iris-climate-change by @Muhammad.Waseem
Carbon Footprint Counter by @Yuri.Gomes
➡️ Voting is here.
Community Nomination, Top 3
iris-climate-change by @Muhammad.Waseem
Carbon Footprint Counter by @Yuri.Gomes
interoperability-manager by @Oliver.Wilms
➡️ Voting is here.
So, the voting continues.
Please support the application you like! Here are the results after 2 days of voting:
Expert Nomination, Top 3
Kozo by @Sean Connelly
iris-climate-change by @Muhammad Waseem
interoperability-manager by @Oliver.Wilms
Carbon Footprint Counter by @Yuri.Gomes
World ice level by @Oleh.Dontsov
➡️ Voting is here.
Community Nomination, Top 3
iris-climate-change by @Muhammad Waseem
interoperability-manager by @Oliver.Wilms
Carbon Footprint Counter by @Yuri Marx
Kozo by @Sean Connelly
World ice level by @Oleh.Dontsov
➡️ Voting is here.
So, the voting continues.
Please support the application you like! Devs!
Here are the top 5 for now:
Expert Nomination, Top 3
Kozo by @Sean Connelly
iris-climate-change by @Muhammad Waseem
interoperability-manager by @Oliver Wilms
iris-for-money by @Oliver.Wilms
Carbon Footprint Counter by @Yuri Marx
➡️ Voting is here.
Community Nomination, Top 3
iris-climate-change by @Muhammad Waseem
interoperability-manager by @Oliver Wilms
iris-for-money by @Oliver.Wilms
Carbon Footprint Counter by @Yuri Marx
Arctic sea ice viewer by @Oleh.Dontsov
➡️ Voting is here. Voting for the InterSystems Full Stack Contest 2022 goes ahead!
And here're the results at the moment:
Expert Nomination, Top 3
iris-climate-change by @Muhammad Waseem
Kozo by @Sean Connelly
Carbon Footprint Counter by @Yuri Marx
Arctic sea ice viewer by @Oleh Dontsov
interoperability-manager by @Oliver Wilms
➡️ Voting is here.
Community Nomination, Top 3
iris-climate-change by @Muhammad Waseem
Arctic sea ice viewer by @Oleh Dontsov
interoperability-manager by @Oliver Wilms
Carbon Footprint Counter by @Yuri Marx
Kozo by @Sean Connelly
➡️ Voting is here. Developers!
Last call!Only a few hours left to the end of voting!
Cast your votes for applications you like!
Announcement
Anastasia Dyubaylo · Jul 18, 2022
Hi Community,
Let's meet together at the online meetup with the winners of the InterSystems Full Stack contest – a great opportunity to have a discussion with InterSystems Experts team as well as our contestants. Winners' demo included!
Date & Time: Friday, July 22 – 12:00 PM EDT
Join us to learn more about winners' applications and to have a talk with our experts.
➡️ REGISTER TODAY!
See you at our virtual meetup! Hey Developers,
Watch the recording of the meetup on InterSystems Developers YouTube:
⏯ Online Meetup with InterSystems Full Stack Contest Winners
Announcement
Anastasia Dyubaylo · Dec 27, 2021
Hey everyone,
Lots of new content to read! Thanks to our wonderful participants of the 2nd InterSystems Tech Article Contest!
🌟 25 AMAZING ARTICLES 🌟
So it's time to announce the best of them!
Let's meet the winners and their articles:
⭐️ Expert Awards – winners selected by InterSystems experts:
🥇 1st place: Data anonymization, introducing iris-Disguise by @Henry.HamonPereira
🥈 2nd place: IntegratedML hands-on lab by @José.Pereira
🥉 3rd place and two winners:
VSCode-ObjectScript on GitHub by @Dmitry.Maslennikov
Invite the FHIR® Accelerator Service to your Kubernetes Microservice Party by @Ron.Sweeney1582
⭐️ Community Award – winner selected by Community members, article with the most likes:
🏆 Data anonymization, introducing iris-Disguise by @Henry.HamonPereira
Hope this win will be a great Christmas present for all of the winners!
⭐️ This time, we'd like to reward some more authors for the number of contributions:
@Yuri.Gomes: 4 articles!
@MikhailenkoSergey: 3 articles!
These guys will get Apple AirPods Pro OR Amazon Kindle 8G Paperwhite OR Raspberry Pi 4 8GB with InterSystems IRIS Community Edition ARM installed!
And...
Let's congratulate all our heroes at https://community.intersystems.com/contests/2:
@Robert.Cemper1003
@Henrique.GonçalvesDias
@Muhammad.Waseem
@Rob.Tweed
@John.Murray
@alex.kosinets
@Irene.Mikhaylova
@Oliver.Wilms
@Rizmaan.Marikar2583
THANK YOU ALL! You have made an incredible contribution to our Dev Community!
Happy Holidays to everyone! 🎅
The prizes are in production now. We will contact all the participants when they are ready to ship Thanks my reward and congrats for the participants, great articles! Congratulations everyone. Very impressive! 
What a wonderful surprise!!
Thank you all community and congratulations to all participants Congratulations all, and happy new year Congratulations to ALL. It was nice competition Congratulations to the authors :-) Thanks everybody!!! Congratulations!
We're lucky to have airpods as the third place prize. Those were easy to split equally between the tied contestants :-) Congratulations! Well done everyone! And now we have beautiful badges for all the winners on Global Masters tied to levels - so these badges will help you to move up through GM levels! Congrats and Happy New Year! Dear participants, regarding prizes and swag delivery: we will be in touch with you at the beginning of January - shortly after the Holidays.
Article
José Pereira · Dec 27, 2021
In the previous articles, we learned the basics of using IMAP protocol to handle messages from mailboxes in an e-mail server. That was cool and interesting, but you could take advantage of implementations created by other ones, available in libraries ready to use.
One of the improvements to the IRIS data platform is the ability to write Python code alongside ObjectScript in the same IRIS process. This new feature is called [Embedded Python](https://community.intersystems.com/post/start-learning-about-embedded-python). Embedded Python lets us bring to our ObjectScript code the power of the huge [Python ecosystem’s libraries](https://pypi.org/).
In this article, we’ll use one of those libraries, called [imaplib](https://docs.python.org/3/library/imaplib.html), to implement an IMAP client and integrate it with the [IRIS Email Framework](https://community.intersystems.com/post/implementing-imap-client-intersystems-iris-part-ii). We’ll also review a practical example of how to use embedded Python to resolve real-world challenges on the IRIS platform with the help of the Python ecosystem.
You can find all code implemented here in this GitHub [repository](https://github.com/jrpereirajr/iris-imap-inbound-adapter-demo), in the [python directory](https://github.com/jrpereirajr/iris-imap-inbound-adapter-demo/tree/main/src/dc/demo/imap/python).
Note that Python code just works in recent IRIS versions. In this example, the used version was 2021.1.0.215.3-zpm. You can follow updates about Embedded Python [here](https://community.intersystems.com/tags/python).
## Using Embedded Python
The key to using embedded Python is the class %SYS.Python. By using this class, we can:
* Import Python libraries: `##class(%SYS.Python).Import(“package-name”)`
* Import custom Python modules (*.py files) available into the local system: `##class(%SYS.Python).Import(“module-file.py”)`
* Get some Python built-in types to be used in assignments or parameters, for instance:
* Python None object: `##class(%SYS.Python).None()`
* Python True object: `##class(%SYS.Python).True()`
* Python False object: `##class(%SYS.Python).False()`
* Convert ObjectScript strings to Python Bytes objects (8-bit strings): `##class(%SYS.Python).Bytes(“ObjectScript string”)`
These methods create Python objects and return an ObjectScript object. We can use the Python object’s properties and methods directly in our ObjectScript code.
For instance, let’s see how we can implement this Python [recipe](https://docs.python.org/3/library/secrets.html#recipes-and-best-practices) for using the secrets library to generate passwords:
USER>Set string = ##class(%SYS.Python).Import("string")
USER>Set secrets = ##class(%SYS.Python).Import("secrets")
USER>ZWrite secrets // let's check what this object is...
secrets=1@%SYS.Python ; ;
USER>ZWrite string // same for this one...
string=2@%SYS.Python ; ;
USER>Set alphabet = string."ascii_letters" _ string.digits // here we are accessing Python properties from string object
USER>Set pwd = ""
USER>For i=1:1:8 { Set pwd = pwd _ secrets.choice(alphabet) }
USER>Write pwd
Qv7HuOPV
In this code, we use several properties and methods from Python objects to set ObjectScript variables. We use ObjectScript variables as parameters for Python objects methods.
Another key point to using embedded Python is unique attributes and methods, sometimes called magical methods. Because everything in [Python data models](https://docs.python.org/3/reference/datamodel.html) are objects, these attributes and methods provide the Python interpreter's interface. For example, here’s how we retrieve an item from a list by its index, using the [\_\_getitem\_\_](https://docs.python.org/3/reference/datamodel.html#object.\_\_getitem\_\_) special method:
USER>Set b = ##class(%SYS.Python).Import("builtins")
USER>Set list = b.list() // creates a Python list
USER>Do list.append(1)
USER>Do list.append(2)
USER>Do list.append(3)
USER>ZWrite list
list=4@%SYS.Python ; [1, 2, 3] ;
USER>w list."__getitem__"(0) // in Python, indexes are 0-based
1
USER>w list."__getitem__"(2)
3
In the same way, we can get the length of the list by using the \_\_len\_\_ special method:
USER>Set listLen = list."__len__"()
USER>ZWrite listLen
listLen=3
We can combine them to iterate the list using ObjectScript:
USER>For i=0:1:(listLen - 1) { Write list."__getitem__"(i), ! }
1
2
3
If we need to use constant values like None, True, or False, we can use the following methods from the %SYS.Python class:
USER>Set none = ##class(%SYS.Python).None()
USER>Set true = ##class(%SYS.Python).True()
USER>Set false = ##class(%SYS.Python).False()
USER>ZWrite none, true, false
none=5@%SYS.Python ; None ;
true=6@%SYS.Python ; True ;
false=7@%SYS.Python ; False ;
Similarly, we can convert an ObjectScript string to a Python Bytes object:
USER>Set bytes = ##class(%SYS.Python).Bytes("This is a string")
USER>ZWrite bytes
bytes=8@%SYS.Python ; b'This is a string' ;
Finally, we define our custom Python modules and import them into the ObjectScript context.
You can find more useful resources on how to use embedded Python [here](https://community.intersystems.com/tags/python). For instance, check out this nice [example](https://community.intersystems.com/post/websocket-client-embedded-python) by [Robert Cemper](https://community.intersystems.com/user/robert-cemper-0).
## Writing an Alternative IMAP Client
To use imaplib to implement our IMAP client, we use the regular [ObjectScript](https://community.intersystems.com/post/implementing-imap-client-intersystems-iris-part-i). We override its methods with the imaplib methods instead of implementing the IMAP protocol from the beginning.
First, we create a new class named dc.demo.imap.python.IMAPPy. This class uses two properties to store references to Python objects:
Class dc.demo.imap.python.IMAPPy Extends dc.demo.imap.IMAP
{
/// Stores the imaplib object reference
Property imaplib As %SYS.Python;
/// Stores the imaplib client instance
Property client As %SYS.Python;
...
Next, we import the imaplib library into the ObjectScript context, in the class constructor:
Method %OnNew() As %Status [ Private ]
{
Set ..imaplib = ##class(%SYS.Python).Import("imaplib")
Return $$$OK
}
Now, we can access all imaplib properties and methods using the imaplib class property. The first method that we override was the Connect method. This method uses the imaplib IMAP4_SSL method to make a connection to the IMAP server. It stores the imaplib client instance as a client property.
The login method of the imaplib client will authenticate login requests, as follows:
Method Connect(pServer As %String, pUserName As %String, pPassword As %String) As %Status
{
If ..Connected Return $$$ERROR($$$ConnectedError)
Set sc = $$$OK
Try {
Set ..Server = pServer
Set ..UserName = pUserName
Set ..client = ..imaplib."IMAP4_SSL"(..Server)
Set resp = ..client.login(..UserName, pPassword)
Set ..Connected = 1
}
Catch ex {
Set sc = ex.AsStatus()
}
Return sc
}
The next method we override is the Disconnect method. This method now calls the logout method from the imaplib client:
Method Disconnect() As %Status
{
Set sc = $$$OK
Try {
If ..Connected {
Set tuple = ..client.logout()
Set ..Connected = 0
}
}
Catch ex {
Set sc=ex.AsStatus()
}
Return sc
}
The method GetMailBoxStatus was overridden to use the select method from imaplib to specify which mailbox to access.
Method GetMailBoxStatus(ByRef NumberOfMessages As %Integer, ByRef NumberOfBytes As %Integer) As %Status
{
Set sc = $$$OK
Try {
Do ..CheckConnection()
Set resp = ..client.select(..MailboxName)
Set ackToken = resp."__getitem__"(0)
Set dataArray = resp."__getitem__"(1)
Set NumberOfMessages = dataArray."__getitem__"(0)
Set NumberOfBytes = -1
}
Catch ex {
Set sc=ex.AsStatus()
}
Return sc
}
Note that this method returns a tuple, so the special method \_\_getitem\_\_ allows us to retrieve information. Also, remember that a tuple can store another tuple, so we can recursively use \_\_getitem\_\_.
The following method overridden was GetSizeOfMessages. This method now uses the select method to choose the current mailbox and the fetch method to get the size of the message stored in the MessageNumber parameter.
Method GetSizeOfMessages(MessageNumber As %String = "", ByRef ListOfSizes As %ArrayOfDataTypes) As %Status
{
Set sc = $$$OK
Try {
Do ..CheckConnection()
// select the mailbox
Set resp = ..client.select(..MailboxName)
// hack to ensure that MessageNumber is of type %String
Set MessageNumber = MessageNumber_""
Set resp = ..client.fetch(MessageNumber, "(RFC822.SIZE)")
Set ackToken = resp."__getitem__"(0)
Set dataArray = resp."__getitem__"(1)
Set:('$ISOBJECT($Get(ListOfSizes))) ListOfSizes = ##class(%ArrayOfDataTypes).%New()
Set data = dataArray."__getitem__"(0)
Set msgIdx = +$Piece(data, " ", 1)
Set size = +$Piece(data, " ", 3)
Do ListOfSizes.SetAt(size, msgIdx)
}
Catch ex {
Set sc=ex.AsStatus() }
Return sc
}
We override the GetMessageUIDArray method in the same way to use the fetch method, but now we use it to get the UID codes:
Method GetMessageUIDArray(MessageNumber As %String = "", ByRef ListOfUniqueIDs As %ArrayOfDataTypes) As %Status
{
Set sc = $$$OK
Try {
Do ..CheckConnection()
// select the mailbox
Set resp = ..client.select(..MailboxName)
Set mailboxSize = resp."__getitem__"(1)."__getitem__"(0)
If (mailboxSize > 0) {
// hack to ensure that MessageNumber is of type %String
Set MessageNumber = MessageNumber_""
// then get the mailbox UIDs
Set param = $CASE(MessageNumber, "":"1:*", :MessageNumber)
Set resp = ..client.fetch(param, "UID")
Set ackToken = resp."__getitem__"(0)
Set dataArray = resp."__getitem__"(1)
Set len = dataArray."__len__"()
} Else {
Set len = 0
}
Set:('$ISOBJECT($Get(ListOfUniqueIDs))) ListOfUniqueIDs = ##class(%ArrayOfDataTypes).%New(len)
For i = 1:1:len {
Set data = dataArray."__getitem__"(i - 1)
Set msgIdx = +$Piece(data, " ", 1)
Set size = +$Piece(data, " ", 3)
Do ListOfUniqueIDs.SetAt(size, msgIdx)
}
}
Catch ex {
Set sc=ex.AsStatus()
}
Return sc
}
Note the use of the \_\_getitem\_\_ and \_\_len\_\_ methods to iterate over the tuples in the dataArray variable:
…
Set len = dataArray."__len__"()
…
For i = 1:1:len {
Set data = dataArray."__getitem__"(i - 1)
Set msgIdx = +$Piece(data, " ", 1)
Set size = +$Piece(data, " ", 3)
Do ListOfUniqueIDs.SetAt(size, msgIdx)
}
Next, we override the Fetch method, which we use to retrieve the whole message body:
Method Fetch(MessageNumber As %Integer, ByRef Msg As %Net.MailMessage, Delete As %Boolean, messageStream As %BinaryStream) As %Status
{
Set sc = $$$OK
Try {
Do ..CheckConnection()
// select the mailbox
Set resp = ..client.select(..MailboxName)
// hack to ensure that MessageNumber is of type %String
Set MessageNumber = MessageNumber_""
// get the whole message
Set resp = ..client.fetch(MessageNumber, "BODY.PEEK[]")
Set rawMsg = ..TransversePythonArray(resp."__getitem__"(1))
...
}
Catch ex {
Set sc=ex.AsStatus()
}
Return sc
}
Note the presence of the method TransversePythonArray. Because the message body returned by the fetch method is a composition of collections, we created this method to recursively transverse this collection and flatten it into a single string.
ClassMethod TransversePythonArray(pArray As %SYS.Python) As %String
{
Set acc = ""
If ($IsObject(pArray)) {
Set len = pArray."__len__"()
For i = 1:1:len {
Set item = pArray."__getitem__"(i - 1)
If ($IsObject(item)) {
Set acc = acc_..TransversePythonArray(item)
} Else {
Set acc = acc_item
}
Set acc = acc_$Char(13, 10)
}
} Else {
Set acc = pArray_$Char(13, 10)
}
Return acc
}
We also override the Ping method to use the imaplib noop method.
Method Ping() As %Status
{
Set sc = $$$OK
Try {
Do ..CheckConnection()
Set resp = ..client.noop()
}
Catch ex {
Set sc=ex.AsStatus()
}
Return sc
}
The last method overridden was the CommitMarkedAsDeleted method. It now uses the methods store and expunge to mark messages for deletion and to commit such operations.
Method CommitMarkedAsDeleted() As %Status [ Internal, Private ]
{
Set sc = $$$OK
Try {
Do ..CheckConnection()
// select the mailbox
Set resp = ..client.select(..MailboxName)
// transverse array in inverse order to keep numbers integrity,
// that is, ensures that when the number is deleted no other
// message can assume such number
Set messageNumber = $Order(..MarkedAsDeleted(""), -1)
While (messageNumber '= "") {
// hack to ensure that messageNumber is of type %String
Set messageNumber = messageNumber_""
Set resp = ..client.store(messageNumber, "+FLAGS", "\Deleted")
Set messageNumber = $Order(..MarkedAsDeleted(messageNumber), -1)
}
Kill ..MarkedAsDeleted
Set resp = ..client.expunge()
}
Catch ex {
Set sc=ex.AsStatus()
}
Return sc
}
## Conclusion
This method is much easier to implement compared to the original one, where we had to implement each IMAP command manually using IRIS TCP commands. Now that you’ve seen a good example of how we can use the rich Python library ecosystem for real-world problems, start powering up your ObjectScript applications!
## References
* [imaplib — IMAP4 protocol client](https://docs.python.org/3/library/imaplib.html)
* [Video: Embedded Python in InterSystems IRIS: Sneak Peek](https://community.intersystems.com/post/new-video-embedded-python-intersystems-iris-sneak-peek)
* [Embedded Python: Bring the Python Ecosystem to Your ObjectScript App](https://learning.intersystems.com/course/view.php?id=1572)
* [Learn Python Network Programming: Python - IMAP](https://www.tutorialspoint.com/python_network_programming/python_imap.htm)
* [Python Documentation: Recipes and Best Practices](https://docs.python.org/3/library/secrets.html#recipes-and-best-practices)
* [Python Documentation: Data Model](https://docs.python.org/3/reference/datamodel.html)
* [WebSocket Client with Embedded Python](https://community.intersystems.com/post/websocket-client-embedded-python)
* [InterSystems Developer Community: #Python](https://community.intersystems.com/tags/python)
Hi, @José.Pereira! Ia it possible to build a ZPM module for the case? And publish it on Open Exchange?
Announcement
Evgeny Shvarov · Dec 28, 2021
Hi Developers!
Here're the technology bonuses for the InterSystems IRIS Datasets Contest 2021 that will give you extra points in the voting:
Dataset Usage Demo Repository - 4
LOAD DATA Usage - 3
Questionnaire - 2
Unique Real Dataset - 4
Docker container usage - 2
ZPM Package deployment - 3
Online Demo - 2
Code Quality pass - 1
First Article on Developer Community - 2
Second Article On DC - 1
Video on YouTube - 3
See the details below.
Dataset Usage Demo Repository - 4 points
Your application for the contest is a dataset itself. So it's very important and helpful if you submit another repo with the usage example of the data.
Just mention the second demo repository in the README.md of your dataset repo and collect 4 extra points.
LOAD DATA Usage - 3 points
InterSystems IRIS 2021.2 preview release comes with the new feature to LOAD DATA. Use it in your dataset or demo repo and collect 3 extra points.
Questionnaire - 2
Share your feedback in the questionnaire and collect 2 extra points!
Unique Real Dataset - 4
Publish a new real-world dataset that has at least 10k rows and is not trivial and collect 4 bonus points. A good example of a trivial dataset could be the temperature reading of your Google Nest device. We will count the trivial once of a kind, the first published get the preference.
Docker container usage - 2 points
The application gets a 'Docker container' bonus if it uses InterSystems IRIS running in a docker container. Here is the simplest template to start from.
ZPM Package deployment - 3 points
You can collect the bonus if you build and publish the ZPM(ObjectScript Package Manager) package for your Full-Stack application so it could be deployed with:
zpm "install your-multi-model-solution"
command on IRIS with ZPM client installed.
ZPM client. Documentation.
Online Demo of your project - 2 pointsCollect 2 more bonus points if you provision your project to the cloud as an online demo. You can do it on your own or you can use this template - here is an Example. Here is the video on how to use it.
Code quality pass with zero bugs - 1 point
Include the code quality Github action for code static control and make it show 0 bugs for ObjectScript.
Article on Developer Community - 2 points
Post an article on Developer Community that describes the features of your project and collect 2 points for the article.
The Second article on Developer Community - 1 point
You can collect one more bonus point for the second article or the translation regarding the application. The 3rd and more will not bring more points but the attention will all be yours.
Video on YouTube - 3 points
Make the Youtube video that demonstrates your product in action and collect 3 bonus points per each.
The list of bonuses is subject to change. Stay tuned!
Good luck in the competition!
UPD: Using Demo repo SHOULD have the functionality that shows the usage of the dataset - analytics, any meaningful UI around, etc. - something that shows why the dataset is good and how it can be used. Same for the Online Demo What is Unique Real Dataset? Real data means - not generated data.
Unique means new and never existed before.
In fact, it is the dataset you own - e.g. your collection of coins, or your library. Or the set of observations of any kind. Thanks I think dataset-finance should qualify as Unique Real Dataset.
Article
Yuri Marx Pereira Gomes · Jan 5, 2022
According to the WHO, The top global causes of death, in order of total number of lives lost, are associated with three broad topics (source: https://www.who.int/news-room/fact-sheets/detail/the-top-10-causes-of-death):
Cardiovascular (ischaemic heart disease, stroke),
Respiratory (chronic obstructive pulmonary disease, lower respiratory infections) and
Neonatal conditions – which include birth asphyxia and birth trauma, neonatal sepsis and infections, and preterm birth complications.
I created an application that's provides real data (without personal data) for some of these top 10 scenarios of diseases identified by WHO. The datasets for this application are:
Diabetes dataset: data to predict diabetes diagnosis
Heart Disease: data to predict heart disease
Kidney Disease: data to predict kidney disease
Breast Cancer: data to predict breast cancer
Maternal Health Risk: data to predict maternal health risk level
To download and install the application go to https://openexchange.intersystems.com/package/Health-Dataset
Follow these instructions:
1. Clone/git pull the repo into any local directory
$ git clone https://github.com/yurimarx/automl-heart.git
2. Open a Docker terminal in this directory and run:
$ docker-compose build
3. Run the IRIS container:
$ docker-compose up -d
4. Do a Select to the HeartDisease dataset:
SELECT
age, bp, chestPainType, cholesterol, ekgResults, exerciseAngina, fbsOver120, heartDisease, maxHr, numberOfVesselsFluro, sex, slopeOfSt, stDepression, thallium
FROM dc_data_health.HeartDisease
5. Do a Select to the Kidney Disease dataset:
SELECT
age, al, ane, appet, ba, bgr, bp, bu, cad, classification, dm, hemo, htn, pc, pcc, pcv, pe, pot, rbc, rc, sc, sg, sod, su, wc
FROM dc_data_health.KidneyDisease
6. Do a Select to the Diabetes dataset:
SELECT
Outcome, age, bloodpressure, bmi, diabetespedigree, glucose, insulin, pregnancies, skinthickness
FROM dc_data_health.Diabetes
7. Do a Select to the Breast Cancer dataset:
SELECT
areamean, arease, areaworst, compactnessmean, compactnessse, compactnessworst, concavepointsmean, concavepointsse, concavepointsworst, concavitymean, concavityse, concavityworst, diagnosis, fractaldimensionmean, fractaldimensionse, fractaldimensionworst, perimetermean, perimeterse, perimeterworst, radiusmean, radiusse, radiusworst, smoothnessmean, smoothnessse, smoothnessworst, symmetrymean, symmetryse, symmetryworst, texturemean, texturese, textureworst
FROM dc_data_health.BreastCancer
8. Do a Select to the Maternal Health Risk dataset:
SELECT
BS, BodyTemp, DiastolicBP, HeartRate, RiskLevel, SystolicBP, age
FROM dc_data_health.MaternalHealthRisk
These datasets can be used into AutoML/Machine Learning applications to support breast cancer, heart disease, kidney disease and diabetes diagnostics (support only, because human doctor diagnosis is mandatory).
Enjoy! Hi Yuri,
Your video is now on InterSystems Developers YouTube:
⏯ Health Datasets using InterSystems IRIS
Have a good weekend) Great! Thanks!
Discussion
Evgeny Shvarov · Jul 20, 2021
Hi folks!
How do you edit data in IRIS or Caché? What do you use?
Change globals directly via Management Portal?
Change data using SQL?
Use your favorite dev tool? Which one?
Crafted your own?
Share your experience, please?
Hi,
we are updating the data using an update query via the management portal. Globals need to change then we are using the terminal to change it. Recently, started to Visual studio code extension of SQL Tools. but frequently check and update the above would not work out. each time change query parameters. so we created a zen page to do the CRUD operations to the particular table. I see, thank you @Karunanithi.Veerarajan I don't have a real favorite.
- for similar changes in multiple records, I use SQL in SMP, rarely also $system.SQL.Shell() from terminal- for single changes, I use Global Edit in SMP and direct access in terminal equally- for special objects I often write my class related customized edit method I believe the best answer is: It depends.Depends on the data architecture of the original project, whether the data structure is GLOBAL, relative SQL or Objects.
For example, in my current project, I have data in objects originating from Ensemble and metrics and monitoring data in relational tables. The native part of Ensemble is never subject to change, but the part concerning relational tables sometimes needs editing. When it happens I prefer to use third party SQL manager like DBeaver.
In another project, fully specified in Globals, the preferred way of editing large amounts of data was to write scripts in ObjectScript.
Edit globals directly, only in very specific situations. And keep in mind that, if the global is referring to an SQL table, there is always the risk of corrupting an index. Hi. The team I work in has been supporting old MUMPS and then Cache systems for many years, and have two rules for fixing data on live systems:
1. Never write a kill statement directly at the command line.It's quick and convenient, but we've seen many occasions where big chunks of, or, before the database parameter to stop it, whole globals were removed by accident. Cue major panics, hours of restore and de-journal. etc.
2. Don't write SQL updates directly (SMP, command line, etc).
Because if you get the WHERE wrong then all rows in a table suddenly vanish or have the same value. :-)
So we use a local command line tool for global amendments that uses the old %G style selection search to display one node at a time, so that you can then edit the data, or kill (with a warning first if there are sub nodes you may have forgotten about).
We also have a local command line tool for SQL/objects. This takes in a table name and WHERE clause, and only allows editing and deleting when the query finds only one row.
Anything more than a few nodes/rows and we usually write a proper bit of script on our dev server, and get it checked and tested before running in live. Better safe than sorry. What a thrilling and scary story, Mike!
I need this editing feature for development purposes only. Thanks Marcio, I agree Why such a complicated question, I wonder. Can anyone answer immediately the "Best Tool" for any given job (other than a salesman, of course)?
I'm a fan of writing my own SQL commands on the SQL Browser (it gives me a sense of power that comes from using the raw tools some deity provided for me) but hey, if it's as simple as editing a bunch of records, well my choice is Dbeaver Community Edition (through JDBC) but it's not the only one based on java (that's why JDBC driver is needed). The one I downloaded came with its own OpenJDK (but it's not full java as some .dll, .dylib or .so libraries are included). It seems you can even install it as some Eclipse plugin if you want! I haven't tested this one yet though.
Well it's simple and you can use the jar that's in the <instance-dir>/dev/java/lib/JDK11/intersystems-jdbc-<version>.jar. It offers to download one as you establish your first connection to an "InterSystems IRIS" or "Cache" database, check this Dbeaver officially supports ....
It has a nice "view data" for a table and allows to edit in a grid (you have to "save" in order to trigger all the UPDATE commands necessary or see them prior to submitting/saving). It's filterable so you see just a range of data you want to edit as in "ID between 40 and 50". If you have some primary key (other than the ID column which is hidden to the beaver but you still can use it to filter data) then the updates will use it no questions asked, otherwise you can use all the columns for the updates but you know how that can have unwanted repercussions.
It also has the usual import and export (using csv files with mapped columns, just don't use any identity columns!) and the community edition is supposed to be under an apache license. If you really like of course you can buy some license that gives you a full load of functionalities but if it's just to edit some records, I'd stick to the community edition. Thanks, Robert! For those who are not aware - SMP stands for System Management Portal - the web UI to manage IRIS. Thanks, Robert! For those who are not aware - SMP stands for System Management Portal - the web UI to manage IRIS. Thanks, Pablo! Yes, I like DBeaver too. RESTForms, duh.
Article
Yuri Marx Pereira Gomes · Oct 29, 2021
The Zachman Framework™ is an ontology - a theory of the existence of a structured set of essential components of an object for which explicit expressions is necessary and perhaps even mandatory for creating, operating, and changing the object (the object being an Enterprise, a department, a value chain, a “sliver,” a solution, a project, an airplane, a building, a product, a profession or whatever or whatever). Source: https://www.zachman.com/about-the-zachman-framework.
In this article I use the Zachman Framework to detail how can you use InterSystems IRIS to promote your enterprise architecture project.
The InterSystems IRIS can represent things important to the business using Persistent Classes with encapsulated reusable business logic that can be consumed as REST, Language Gateways (Python, Java, .Net and Node.js) or into IRIS productions (BPL, Business Services and Business Operations).
The Analytics dashboards created with IRIS Analytics (Deepsee), IRIS Reports and IRIS Adaptative Analytics (AtScale) materialize business important things as dashboards for business staff.
Finally, the InterSystems IRIS Interoperability productions automate things important to the business with BPL, DTL, Business Rules and Business Services and Operations in a business component consumed as REST, HTTP resource and other popular formats and protocols.
The InterSystems IRIS automate business processes, including human tasks, using InterSystems IRIS productions with BPL. The business process indicators can be monitored using InterSystems Analytics capabilities (DeepSee, IRIS Reports and IRIS Adaptative Analytics)
The InterSystems IRIS supports the main languages (english, portuguese, spanish, japanese and other) to operate the business globally. The database, components and analytics artifacts can be deployed in a distributed network or in the cloud.
The InterSystems IRIS supports the definition of roles, people and resources with a integrated security model into the API Gateway (APIM) and in the database, interoperability and component layers, using OAuth, JWT, LDAP, RBAC and other models.
In the Analytics users can colaborate and share business artifacts, creating corporate insights.
The InterSystems IRIS has support to the international time zones and support operate data and application as real time or batch schedule events as syncronous or asyncronous request or responses, using the most popular protocols (kafka, mqtt, rest, http, smtp, and other).
The data into these events can be monitored and analyzed with IRIS Analytics options (DeepSee, SAM, Adaptative Analytics and IRIS Reports).
The IRIS Analytics options (Deepsee, IRIS Reports, Adaptative Analytics) allows you create KPIs to analyse the progress of business goals and strategies.
The IRIS API Management can map business goals and strategies to the corporate REST Services (digital business assets) and promote its reuse with InterSystems Interoperability productions (create compositions to realize the strategy).
The IRIS Multimodel Database is prepared to support relational, class oriented, analytics and document data models.
The IRIS Interoperability productions can use BPL to model and execute business processes and can compose the use of machine learning, Java, .Net, Python and Object Script components and other corporate digital assets consumed using adapters.
The IRIS deployment model supports creating business microsservices into docker services distributed into business services or technology services (ESB as service, Analytics as service, Database as service) into private and public clouds.
The InterSystems IRIS interoperability BPL can model and execute workflows with automated and human tasks.
With InterSystems IRIS you can schedule the deployment of reports (InterSystems Reports), dashboads output (DeepSee) and component/orchestration logic using the InterSystems BPL and Business Rules engine.
IRIS support produce and consume events and messages too, including MQTT (IoT), Kafka and JMS.
The Business Plan can be realized using IRIS Data Platform in all layers:
1. Data: planning to get, process and analyse data can be done with IRIS Interoperability BPL and Adapters with data storage in a multimodel database (SQL, Document/JSON, OLAP).
2. Application: create services and microservices using Java, .Net, Python and ObjectScript as REST services or interoperability services that realize the business requirements planned.
3. Technology: the business continuity is possible because IRIS supports HA and distributed computing in Data (shards), in Application (docker services) and in analytics (docker analytics services).
The InterSystems IRIS create your ORM model automatically (each class is a table and properties can be relations between classes). So your logical model is translated to pyshical model as SQL and Classes at same time.
The Application architecture in the InterSystems IRIS can be monolitic, as services or as microservices, because IRIS supports host, docker and kubernetes deployments.
The IRIS application architecture is open to the main languages (Java, .Net, Python, ObjectScript and Node.js/JavaScript).
Finally the IRIS application architecture supports analytics, data and language services and microservices implementations.
IRIS supports AWS, Azure, Google Cloud and other public and private distributed architectures.
IRIS supports sharding to distributed data repositories too.
For applications, IRIS can serve data responses to Angular, Vue, React, React Native, Flutter and other popular UI options, including NPM package to allows the controller classes interact with IRIS components using Node.js/Javascript.
In the analytics area, IRIS deliver analytics insights to Power BI, Tableau and Excel (Adaptative Analytics).
The processing into IRIS can be asyncronous or syncronous. All processing can be orchestrated using APIM or using IRIS ESB/BPL.
The dashboards and reports can be processed into the User Portal or into the the applications (embedded).
The InterSystems IRIS has a business rules engine integrated to the BPL workflow, allow you using the business rules with your business process or data/service workflows.
For AI business rules is possible compose with Python and R machine learning components inside the business process (BPL) or you can use IntegratedML too, to train and execute AI rules using SQL sentences.
The Physical Data Model in IRIS can be monolitic or distributed (shards) and the data is multimodel (SQL, NoSQL (JSON), OLAP and Virtual Cubes (AtScale)).
The InterSystems IRIS allows you design analytical, data, interoperability and open language systems into monolitic or microservice deployments, using private or public clouds.
With IRIS the technology architeture is end-to-end, including:
1. API Management with InterSystems API Management;
2. ESB, Integration Adapters and Workflow with InterSystems Interoperability (Ensemble);
3. Business Services and Microservices using the most popular languages;
4. Analytics with IRIS Reports, IRIS Adaptative Analytics and DeepSee;
5. Advanced Analytics and Data Science with IntegratedML and Python/R gateways;
6. Deployment into VM, Docker, Kubernetes or hosts.
IRIS deliver responses and process requests using REST/API Gateway or using Node.js NPM package.
For analytical visualizations, IRIS deliver MDX or SQL data for PowerBI, Tableau and other.
The InterSystems IRIS allow you control:
1. API with InterSystems API Management;
2. Services and Microservices with InterSystems API Management and InterSystems Interoperability productions (BPL);
3. Services and Microservices with Language Gateways (for Java, Python, .Net and Javascript/Node.js);
4. Data as InterSystems IRIS multimodel database (SQL, NoSQL - JSON - DocDB, OLAP - DeepSee);
5. Analytical with IRIS Analytics and Adaptative Analytics (AtScale);
6. Cognitive with IRIS IntegratedML and Python/R language support.
The InterSystems IRIS has a rule engine inside InterSystems Interoperability.
Article
Eduard Lebedyuk · Mar 5, 2022
Function as a service (FaaS) is a category of cloud computing services that provides a platform allowing customers to develop, run, and manage application functionalities without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app. Building an application following this model is one way of achieving a "serverless" architecture, and is typically used when building microservices applications.
Wikipedia
FaaS is an extremely popular approach to running workloads in the cloud, allowing developers to focus on writing code.
This article will show you how to deploy InterSystems IRIS methods in a FaaS way.
Install Kubernetes
First of all, install Kubernetes 1.16. There are a lot of guides available so that I won't be copying them here, but I'm using minicube. With minicube to run kubernetes, it's enough to execute this command:
minikube start --kubernetes-version=v1.16.1
Install kubeless
Next, we will install kubeless. kubeless is a Kubernetes-native serverless framework that lets you deploy small bits of code without worrying about the underlying infrastructure plumbing. It leverages Kubernetes resources to provide auto-scaling, API routing, monitoring, troubleshooting, and more.
kubectl create ns kubeless
kubectl create -f https://github.com/kubeless/kubeless/releases/download/v1.0.8/kubeless-v1.0.8.yaml
kubectl get pods -n kubeless
Output should be something like this:
NAME READY STATUS RESTARTS AGEkubeless-controller-manager-666ffb749-26vhh 3/3 Running 0 83s
You also need to install a kubeless client (on the same instance you have kubectl). You can get it here. Installation on Linux is as simple as:
sudo install kubeless /usr/local/bin/kubeless
Test kubeless
First, let's deploy a simple Python function to check that kubeless works.
Create test.py:
def hello(event, context):
return event['data']
To read more about function environment check this doc, generally function accepts two arguments - event and context with this data:
event:
data: # Event data
foo: "bar" # The data is parsed as JSON when required
event-id: "2ebb072eb24264f55b3fff" # Event ID
event-type: "application/json" # Event content type
event-time: "2009-11-10 23:00:00 +0000 UTC" # Timestamp of the event source
event-namespace: "kafkatriggers.kubeless.io" # Event emitter
extensions: # Optional parameters
request: ... # Reference to the request received
response: ... # Reference to the response to send
# (specific properties will depend on the function language)
context:
function-name: "pubsub-nodejs"
timeout: "180"
runtime: "nodejs6"
memory-limit: "128M"
Now we can deploy our hello function by specifying our file with a function and a runtime:
kubeless function deploy hello --runtime python3.7 --from-file test.py --handler test.hello
kubeless function ls hello
And let's test it:
kubeless function call hello --data 'Hello world!'
You should receive Hello World! as an answer.
Add IRIS config
Next we need to add an InterSystems IRIS function handler, to do that open kubeless config for edit:
kubeless get-server-config
kubectl get -n kubeless configmaps -o yaml > configmaps.yaml
kubectl edit -n kubeless configmaps
Add this entry to runtime-images array and save:
{"ID": "iris","depName": "","fileNameSuffix": ".cls","versions": [{"images": [{"image": "eduard93/kubeless-iris-runtime:latest","phase": "runtime"}],"name": "iris2022.1","version": "2022.1"}]}
Restart kubeless controller for the changes to take effect.
kubectl delete pod -n kubeless -l kubeless=controller
Build IRIS function CRD and publish it
Now let's write our first function in InterSystems IRIS:
Class User.Test {
ClassMethod hi(event, context) As %Status
{
if $isObject(event) {
write event.Text + event.Text
} else {
write "HELLO FROM IRIS"
}
quit $$$OK
}
}
Next, we need to build a function CRD:
Here's our template:
function.yaml
apiVersion: kubeless.io/v1beta1
kind: Function
metadata:
name: !name!
namespace: default
spec:
runtime: iris2022.1
timeout: "180"
handler: !handler!
deps: ""
function-content-type: text
deployment:
spec:
template:
spec:
securityContext:
runAsUser: 51773
runAsGroup: 51773
function: |
And we need to fill:
name: function name (for kubeless)
handler: class.name_method (for InterSystems IRIS)
function body: add at the end (don't forget tabs!)
So our CRD looks like this:
function_demo.yaml
apiVersion: kubeless.io/v1beta1
kind: Function
metadata:
name: iris-demo
namespace: default
spec:
runtime: iris2022.1
timeout: "180"
handler: User_Test.hi
deps: ""
function-content-type: text
deployment:
spec:
template:
spec:
securityContext:
runAsUser: 51773
runAsGroup: 51773
function: |
Class User.Test {
ClassMethod hi(event, context) As %Status
{
if $isObject(event) {
write event.Text + event.Text
} else {
write "HELLO FROM IRIS"
}
quit $$$OK
}
}
This can be easily automated. On Linux execute:
sed 's/!name!/iris-demo/; s/!handler!/User_Test.hi/' function.yaml > function_demo.yaml
sed 's/^/ /' User.Test.cls >> function_demo.yaml
And on Windows (PowerShell):
Get-Content function.yaml | ForEach-Object { $_ -replace "!handler!", "User_Test.hi" -replace "!name!", "iris-demo" } | Set-Content function_demo.yaml
" " + [string]((Get-Content User.Test.cls) -join "`r`n ") | Add-Content function_demo.yaml
Now we need to publish our CRD in kubeless:
kubectl apply -f function_demo.yaml
Test IRIS function
First, let's see that the function is deployed and ready (can take a few minutes the first time):
kubeless function ls
And now call it:
kubeless function call iris-demo --data '{"Text":123}'
If you're on Windows, call the function like this (same for all other calls with escaped double quotes):
kubeless function call iris-demo --data '{\"Text\":123}'
Anyway, the response should be 456 since 123 is a number.
HTTP access
kubeless also offers HTTP access. To test this, use the kubectl proxy command:
kubectl proxy -p 8081
Next, send this request using your preferred REST API client:
GET http://localhost:8081/api/v1/namespaces/default/services/iris-demo:http-function-port/proxy/
{"Text":111}
Here's how it looks like in Postman:
Next, let's publish it on the internet.
There are two approaches. Preferably configure ingress as described here.
Additionally you can patch function service:
kubectl get svc
kubectl patch svc iris-demo -p '{"spec": {"type": "LoadBalancer"}}'
kubectl get svc
Clean up
To remove a deployed function call:
kubectl delete -f function_demo.yaml
Conclusion
While this is undoubtedly a proof-of-concept and not a production-grade solution, this approach demonstrates that it's possible to run InterSystems IRIS workloads using the serverless, FaaS approach.
Links
Minicube
Kubeless
InterSystems IRIS runtime
Great article !
Is it possible to use a custom image from a local docker registry with Kubeless ? Yes, it's possible. fantastic @Eduard.Lebedyuk ! Thanks, Ron!