Rechercher

Question
· Juil 29, 2024

Died workers of WorkMgr

Started some work using WorkMgr, but then I noticed, that it stuck and does not get any responses from workers anymore

And I found that messages log contains logs about dead processes, why WorkMgr daemon did not restart died processes?

How to restart them without restarting IRIS

07/29/24-15:10:59:589 (856) 2 [Generic.Event] Process terminated abnormally (pid 949, jobid 0x0002001d)
07/29/24-15:10:59:603 (856) 0 [Generic.Event] cleaned dead job, pid: 949, jobid 0x0002001d
07/29/24-15:10:59:603 (856) 2 [Generic.Event] Process terminated abnormally (pid 951, jobid 0x0001001f)
07/29/24-15:10:59:603 (856) 0 [Generic.Event] cleaned dead job, pid: 951, jobid 0x0001001f
07/29/24-15:10:59:603 (856) 2 [Generic.Event] Process terminated abnormally (pid 952, jobid 0x00010020)
07/29/24-15:10:59:604 (856) 0 [Generic.Event] cleaned dead job, pid: 952, jobid 0x00010020
07/29/24-15:10:59:604 (856) 2 [Generic.Event] Process terminated abnormally (pid 953, jobid 0x00010021)
07/29/24-15:10:59:604 (856) 0 [Generic.Event] cleaned dead job, pid: 953, jobid 0x00010021
07/29/24-15:10:59:604 (856) 2 [Generic.Event] Process terminated abnormally (pid 954, jobid 0x00010022)
07/29/24-15:10:59:604 (856) 0 [Generic.Event] cleaned dead job, pid: 954, jobid 0x00010022
07/29/24-15:10:59:604 (856) 2 [Generic.Event] Process terminated abnormally (pid 955, jobid 0x00010023)
07/29/24-15:10:59:604 (856) 0 [Generic.Event] cleaned dead job, pid: 955, jobid 0x00010023
07/29/24-15:10:59:604 (856) 2 [Generic.Event] Process terminated abnormally (pid 956, jobid 0x00010024)
07/29/24-15:10:59:604 (856) 0 [Generic.Event] cleaned dead job, pid: 956, jobid 0x00010024
07/29/24-15:10:59:604 (856) 2 [Generic.Event] Process terminated abnormally (pid 957, jobid 0x00010025)
07/29/24-15:10:59:604 (856) 0 [Generic.Event] cleaned dead job, pid: 957, jobid 0x00010025
07/29/24-15:10:59:604 (856) 2 [Generic.Event] Process terminated abnormally (pid 958, jobid 0x00010026)
07/29/24-15:10:59:604 (856) 0 [Generic.Event] cleaned dead job, pid: 958, jobid 0x00010026
07/29/24-15:10:59:604 (856) 2 [Generic.Event] Process terminated abnormally (pid 959, jobid 0x00010027)
07/29/24-15:10:59:604 (856) 0 [Generic.Event] cleaned dead job, pid: 959, jobid 0x00010027
07/29/24-15:10:59:604 (856) 2 [Generic.Event] Process terminated abnormally (pid 960, jobid 0x00010028)
07/29/24-15:10:59:604 (856) 0 [Generic.Event] cleaned dead job, pid: 960, jobid 0x00010028
Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer
Résumé
· Juil 29, 2024

【週間ダイジェスト】 7/22 ~ 7/28 の開発者コミュニティへの投稿

7/22 ~ 7/28Week at a GlanceInterSystems Developer Community
Article
· Juil 28, 2024 2m de lecture

SQLでレコードをSelectするとSQLエラー -114 が発生します

これは InterSystems FAQ サイトの記事です。

通常SQLCODE -114(一致する行が既に別のユーザにロックされています)のエラーはロックが競合した場合に発生します。

こちらはレコードロック競合があったり、ロック閾値を超える更新を行いテーブルロックに昇格した際に、そのテーブルレコードに対して別のプロセスよりSelectを行い共有ロックを取ろうとして失敗した(ロック待ちがタイムアウトとなった)場合に発生します。

Selectで共有ロックを取る場合というのは、IRIS の ISOLATION LEVEL がREAD COMMITTED(デフォルトはREAD UNCOMMITTED)で、Selectを行った場合です。

例:Sample.Personテーブルにテーブルロックがかかった状態で以下を実行する場合

USER>:sql
SQL Command Line Shell
----------------------------------------------------
 
The command prefix is currently set to: <<nothing>>.
Enter <command>, 'q' to quit, '?' for help.
[SQL]USER>>set transaction isolation level read committed    // Read Committed セット
:
[SQL]USER>>select Name from Sample.Person where Age < 10
2.      select Name from Sample.Person where Age < 10
Name
 
 
[SQLCODE: <-114>:<ひとつまたはそれ以上のマッチする行が別のユーザによりロックされています>]
[%msg: <Unable to acquire shared lock on table Sample.Person for RowID value: 4>]
0 Rows(s) Affected


こちらは、

  • 他のプロセスが該当テーブルの該当IDをロックしている
  • ロック閾値によるテーブルロックを行っている
  • システムのロックテーブルが不足しているためのロックテーブルフル状態

のいずれかになっているものと考えられます。

ロックテーブルフルの場合、messages.log に「LOCK TABLE FULL!!!」のエラーが記録されます。

ロックテーブルフルの場合にロックテーブルサイズを変更する方法は、2023.1 より前のバージョンの場合は こちらの記事 をご覧ください。

2023.1以降のバージョンでは、ロックテーブルサイズは既定で 0 に設定されています。
0 の場合は、構成されたグローバルバッファサイズ(データベースキャッシュサイズ)に基づき、最も効果的な設定値が自動構成されます。


enlightened【ご参考】
SQLのUPDATEやDELETEで、ある程度の数のレコードを一括更新するとSQLエラー -110 が発生します

Discussion (0)0
Connectez-vous ou inscrivez-vous pour continuer
Article
· Juil 28, 2024 6m de lecture

Using Django and Vue.js to create a web application on IRIS: Peeking into the Django framework

For a long time I have wanted to learn the Django framework, but another more pressing project has always taken priority. Like many developers, I use python when it comes to machine learning, but when I first learned web programming PHP was still enjoying primacy, and so when it was time for me to pick up a new complicated framework for creating web applications to publish my machine learning work, I still turned to PHP. For a while I have been using a framework called Laravel to build my websites, and this PHP framework introduced me to the modern Model-View-Controller pattern of web programming. To make things even more complicated, I like to build my front-ends with a modern javascript framework. I am most familiar with Vue.js so for this project I stuck with that even though it is more common to hear of people using React.

Why use a complicated framework anyway? What are the biggest challenges to learning a framework like Django, Laravel, React, or Vue?

Everyone has their own answer, but I have grown to love MVC frameworks because they provide so much guidance on how to structure your app. It prevents me from needing to reinvent the wheel every time. At first these framework can seem constraining and cryptic, but once I become familiar with the structure, I find it is easier to add new features.

The challenge is that things can become almost too simple. Frameworks like Django rely on a lot of shorthand or assumptions that might be based on a familiar concept, but have a particular unfamiliar name and structure in Django. In my application, Django handles the APIs and all the web routing. If I want to add a new API endpoint, I need to add a function to a file in my views.py, then go to the urls.py file and add a statement to import that function and another statement to define the URL where that API endpoint is available. After that, I need to edit my front-end Vue component to use javascript to query that endpoint to obtain data and show it or manipulate it for the user. 

Once my project is set up, adding functionality like this is fast. I only need to add about four lines of code, and then I can concentrate on the logic needed in my new function in the views.py file to process the HTTP request and return the needed data in JSON format. The challenging part is learning what those files are and how they work together to create a whole application.

I find the best way to learn a framework like Django is to find a working example and start trying to make small changes to get a feel for the flow of data. Refer to the documentation as concepts start to become more clear and make more sense. Ask AI models to explain pieces of code and what the different standard files in a framework will do. It doesn't take long to realize that these tools emerged as ways to save time in the long run and make it easy to maintain and update your application. Since the Django and the Vue frameworks have a standard structure, when you come back to them later you will find it is easier to understand why you coded things a certain way, and easier to re-establish familiarity with your work. It's also easier to pick up someone else's application and understand the core functionality since you are familiar with the basic structure of their application. 

So what are some fundamentals of Django that would help someone getting started? For me the first thing to understand is that Django projects are generated by running a command to create a new django project, and this generates a set of basic files and folders that constitute a "base project" that you can use to start building. The project folder will have several python files with settings that apply to the whole project. The important ones you will find yourself visiting frequently are settings.py, where all your settings are, and urls.py. When you have a question like "How does Django decide where to put my static files", the answer is usually somewhere in the settings.py. When you want to add a new URL to your application, you will need to update the urls.py file. 

Along with these project level files, you then create a folder for each app in your project. These apps then need to be registered, i.e. named, in the settings.py file. The main app folder in my project is called documents. Inside that folder I have a models.py file, a serializer.py file, a views.py file. There are others, but these are the important three.

Inside models.py I specify my Document object and the fields it has. Django does the work for me of creating a Documents table in the IRIS database with the schema necessary to save the information I plan to store in the Document objects. In my models.py file I tell it that my Documents all have a name, which is a character string no more than 255 characters, a content field, which is just a large amount of text, as well as a database name where the vectors are stored (another text field), the embedding type (another text field), and finally the vector embedding dimension, which is a number. Using these definitions, Django creates the necessary database table with the necessary column types. Saving objects to the database is then as easy as Document.save().

Inside the serializer.py file is simply a definition on how to convert your object into JSON and vice versa. For basic use cases there is a standard way to define it, and you can see it in this project.

Now we get to the point of Django, the views.py file. This is where we define the functions that accept HTTP requests and return data like an entire HTTP response, or a JSON response in the case of a JSON API. This means Django can deliver an entire web page and also be the front-end of your app, or it can just provide JSON data, and you can build your front-end on an entirely different platform.

At first having the use all of these seemingly arbitrary files and conventions can feel like a chore, but once you see that doing so means your application just starts to work and process HTTP requests and provide the correct data in response, it can be very fun to keep building new features and capabilities. One you've define one object, web route, and function to handle an HTTP request, you realize how easily you can define a second and third to add functionality to your application.

I forked my project from the Iris Django Template create by @Guillaume Rongier here on github: https://github.com/grongierisc/iris-django-template

That template contains only Django, and it was extremely helpful for learning the Django framework. One of the major additions I made was to add Vue.js with Tailwind CSS to show that you can integrate a modern Javascript framework with this package and have a Single Page Application running on IRIS. A Single Page Application is a javascript application that send xhr requests to get JSON data and updates the page dynamically without ever fully reloading it. It has its pros and cons, but it is a hallmark of modern web development.

I encourage people to look at my project as not just en example of RAG and Vector Stores on IRIS, but also as a template for using Django with Vue.js and Tailwind to easily and quickly create modern flexible web application on top of IRIS. That repository is on Github here: https://github.com/mindfulcoder49/iris-django-template

I'd be happy to answer any questions or provide any insight I can into any issues anyone might run into trying to adapt this project for their own use.

2 Comments
Discussion (2)1
Connectez-vous ou inscrivez-vous pour continuer
Question
· Juil 27, 2024

Parse strings in any XML format

Implement a function, write a program, and convert any XML-formatted string into a %XML.Adaptor object without having to create a Moudle class. This makes it easier to work with XML data. How to write it;

Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer