发布新帖

查找

文章
· 五月 13, 2023 阅读大约需 2 分钟

a virgin Jupyter-Notebook

Following one package from the last contest I met a strange problem.
There was the requirement to install jupyter-notebook
I work on Windows and there was some old Python installed
No big surprise: Installation of jupyter-notebook failed
Therefore, the latest version of Python was installed fast.

Big disappointment: the installation of jupyter-notebook failed again!
Because the new installation of Python didn't upgrade the old one.
And also the environment variable PATH was not cleaned
This was not obvious immediately and took endless time and effort.

Several cycles of installation and de-installations followed.
After a lot of manual intervention in Windows settings finally 
allowed Jupyter-Notebook to start.
Though it was not willing to operate in the virtual environment (venv).

This was the point when I had just enough.
I said to myself: "What you do here is just nonsense!"
After cleaning my workspace and the traces of all the failing
installations (several GB) I took a different approach.

  • The idea was to use my well-working Docker installation: 
  • Find a simple container with installed Jupyter-Notebook
  • Fill it with all the required Python modules
  • Forget about venv. More virtual than a Docker container is not possible.
  • Link your local directory into the container. So copying into the container is not necessary.
  • Not to forget the mapping for default port 8888 

The Docker container was built and running in no time 
compared to all my previous attempts. 
It was composed of these 2 files:

Dockerfile

ARG IMAGE=jupyter/base-notebook
FROM $IMAGE
USER root
COPY ./requirements.txt /tmp/requirements.txt
RUN pip3 install -r /tmp/requirements.txt

If you don't have requirements just un-comment the last 2 lines.

docker-compose.yaml

version: '3.9'
services:
  notebook:
    build:
      context: .
      dockerfile: Dockerfile
    entrypoint: jupyter notebook
                --allow-root
                --no-browser
                --ip 0.0.0.0
                --port 8888
                --NotebookApp.token=''
                --NotebookApp.password=''
                --notebook-dir=/ext
    ports:
    - 8888:8888
    volumes:
    - ./:/ext
    

And now after starting the container your Jupyter-Notebook is ready for access.

http://localhost:8888/

This was definitely easier than my previous attempts.
I felt it as a personal success, as this was a totally new territory for me.
 

讨论 (0)1
登录或注册以继续
文章
· 五月 12, 2023 阅读大约需 2 分钟

um Jupyter-Notebook vergine

Seguindo um pacote do último concurso, encontrei um problema estranho.
Havia o requisito para instalar o jupyter-notebook.
Eu trabalho no Windows e havia algum Python antigo instalado.
Nenhuma grande surpresa: a instalação do jupyter-notebook falhou
Portanto, a versão mais recente do Python foi instalada rapidamente.

Grande decepção: a instalação do jupyter-notebook falhou novamente!
Porque a nova instalação do Python não atualizou a antiga.
E também a variável de ambiente PATH não foi limpa
Isso não ficou óbvio imediatamente e exigiu muito tempo e esforço.

Seguiram-se vários ciclos de instalação e desinstalação.
Depois de muita intervenção manual nas configurações do Windows,
Finalmente permitiu que o Jupyter-Notebook fosse iniciado.
Embora não estivesse disposto a operar no ambiente virtual (venv).

Este foi o ponto em que eu tinha apenas o suficiente.
Eu disse a mim mesmo: "O que você faz aqui é um absurdo!"
Depois de limpar meu espaço de trabalho e os rastros de todas as
instalações com falha (vários GB), adotei uma abordagem diferente.

  • Minha ideia era usar minha instalação do Docker que funciona bem.
  • Encontre um contêiner simples com o Jupyter-Notebook instalado
  • Preencha-o com todos os módulos Python necessários
  • Vincule seu diretório local ao contêiner. Portanto, uma cópia no contêiner não é necessária.
  • Para não esquecer o mapeamento para a porta padrão 8888

O contêiner do Docker foi construído e executado em tempo zero
em comparação com todas as minhas tentativas anteriores.
Foi composto por estes 2 arquivos:

Dockerfile

ARG IMAGE=jupyter/base-notebook
FROM $IMAGE
USER root
COPY ./requirements.txt /tmp/requirements.txt
RUN pip3 install -r /tmp/requirements.txt

Se você não tiver requisitos, apenas descomente as 2 últimas linhas.

docker-compose.yaml

version: '3.9'
services:
  notebook:
    build:
      context: .
      dockerfile: Dockerfile
    entrypoint: jupyter notebook
                --allow-root
                --no-browser
                --ip 0.0.0.0
                --port 8888
                --NotebookApp.token=''
                --NotebookApp.password=''
                --notebook-dir=/ext
    ports:
    - 8888:8888
    volumes:
    - ./:/ext
    

E agora, depois de iniciar o contêiner, seu Jupyter-Notebook está pronto para acesso.

http://localhost:8888/

Isso foi definitivamente mais fácil do que minhas tentativas anteriores.
Eu senti isso como um sucesso pessoal,
pois este era um território totalmente novo para mim.

讨论 (0)2
登录或注册以继续
文章
· 五月 9, 2023 阅读大约需 2 分钟

Helper for Objectscript Language Extensions

Creating your own commands or shortcut is one of the strongest features of ObjectScript
If you create your own Language Extensions to ObjectScript you mostly have to find the
proper %ZLANGC00 or %ZLANGV00 or %ZLANGF00 and add the extensions manually.

A few utilities do it already automatically (ZPM, ZME, ..)
This utility allows you to add your extensions also programmatically.

  • eg. at first run, or during installation I found this quite useful for my Docker-based demos as it all happens at start time.

This package includes a demo example to visualize the operation of this utility.

How to Use it

 ; typ = "C" ... command extentson
 ;       "F" ... function extension
 ;       "V" ... variable Extensin
 ; ext = name of the extension
 ; code (by ref) numbered array of lines to add
 ;  
 ; do cmd^zLangExtender(typ,ext,.code)   ;>> add extension 

How to Test it

Open IRIS terminal or console

USER>ZN "%SYS"   
%SYS>do ^zLangExample  
Compiling routine : %ZLANGF00.mac  
label="ZZDUMMY"   
line=6  
line(1)=" ; "   
line(2)=" ; just a demo dummy"  
line(3)="ZZDUMMY(%a) "    
line(4)=" quit " I got '"_%a_"' for test""   
line(5)=" ; what a nice demo "  
line(6)=" ; "   
sc=1   
typ="F"   
**** try ****  
sc=" I got 'hi folks' for test"    
result:
         ;Generated by %ZPM.PackageManager: Start
ZPM(pArgs...) Quit ##class(%ZPM.PackageManager).Shell(pArgs...)  
         ;Generated by %ZPM.PackageManager: End  
         ;  
         ; just a demo dummy  
ZZDUMMY(%a) 
         quit " I got '"_%a_"' for test"  
         ; what a nice demo
         ;
%SYS>   

And if you run it a second time ?
It returns a standard error %Status.

%SYS>do ^zLangExample
%objlasterror="0 ...ZZDUMMY^%ZLANGF00 already defined.........
label="ZZDUMMY"
line=6
line(1)=" ; "
line(2)=" ; just a demo dummy"
line(3)="ZZDUMMY(%a) "
line(4)=" quit " I got '"_%a_"' for test""
line(5)=" ; what a nice demo "
line(6)=" ; "
sc=""0 ...ZZDUMMY^%ZLANGF00 already defined.........
typ="F"
ERROR #5001: ZZDUMMY^%ZLANGF00 already defined
%SYS>

Warning

It is meant mainly for COS experts !

GitHub

Video

讨论 (0)1
登录或注册以继续
文章
· 五月 8, 2023 阅读大约需 4 分钟

ヘルスモニタでのチェック頻度およびアラート通知条件の確認と変更方法

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

InterSystems IRIS では、柔軟でユーザ拡張可能な監視ツールである「システムモニタ」をお使いいただくことが可能です。

システムモニタには、以下の3つのインスタンス監視ツールがあります。

  • システムモニタ:システムの状態およびリソースを監視・固定パラメータに基づいて通知 (アラートおよび警告) を生成
  • ヘルスモニタ:主要なシステムメトリックおよびユーザ定義メトリックをサンプリング&ユーザ変更可能パラメータおよび規定の通常値と比較し、該当しきい値を超えた場合に通知を生成
    ※ヘルスモニタは既定では無効となっています。
     起動するには、^%SYSMONMGR を使用してヘルスモニタを有効にする必要があります。
     ただし、システムモニタのサブスクライバクラスは、ヘルスモニタが有効でなくても動作します。
  • アプリケーションモニタ:重要なシステムメトリックをサンプリング&ユーザが作成したアラート定義を使用して評価

messages.logに、以下のようなログが記録される場合があります。

[SYSTEM MONITOR] DBLatency(c:\xxx\) Warning: DBLatency = 1510 ( Warnvalue is 1000).
※このメッセージの意味については こちらの記事 をご覧ください。

このメッセージはシステムモニタのインスタンス監視ツールであるヘルスモニタにより出力されています。
システムモニタは色々なリソースの使用状況を監視する機能です。
メッセージ中のDBLatency は、データベースの読み取り I/O 速度(ディスク I/O 応答速度)を監視し出力しているものです。


ご参考ドキュメント
IRIS ヘルス・モニタ


このシステムモニタよりコンソールログへメッセージが出力されますが、メッセージの重要度が 0 のものは、インフォメーションのメッセージになります。

センサオブジェクトで設定された最大値や警告値を超えた場合は、メッセージの重要度が 1 Warning , 2 Alert のものを出力します。

Alertの場合:
ある期間のセンサの読み取り値が 3 回連続してセンサの最大値を上回った場合にアラート (深刻度 2 の通知) を生成
Warningの場合:
ある期間のセンサの読み取り値が 5 回連続してセンサの警告値を上回った場合にワーニング (深刻度 1 の通知) を生成


ヘルスモニタのセンサーオブジェクトの設定(最大値等の変更)は、^%SYSMONMGR ユーティリティを使用して行えます。
※システムモニタのセンサオブジェクト設定は固定パラメータであるため変更はできません。

変更例)

DBLatencyのログ出力のしきい値を、
 Alert (深刻度 2 の通知):3000 から 4000 へ
 Warning (深刻度 1 の通知):1000 から 2000 へ
に変更します。

センサオブジェクトの設定を行う前に システムモニタを停止する必要があります。

%SYS>do ^%SYSMONMGR
1) Start/Stop System Monitor
2) Set System Monitor Options
3) Configure System Monitor Classes
4) View System Monitor State
5) Manage Application Monitor
6) Manage Health Monitor
7) View System Data
8) Exit
 
Option? 1
1) Start System Monitor
2) Stop System Monitor
3) Exit
 
Option? 2
Stopping System Monitor... System Monitor stopped
 
1) Start System Monitor
2) Stop System Monitor
3) Exit
 
Option?

センサオブジェクトのしきい値の変更を行います。

%SYS>do ^%SYSMONMGR
1) Start/Stop System Monitor
2) Set System Monitor Options
3) Configure System Monitor Classes
4) View System Monitor State
5) Manage Application Monitor
6) Manage Health Monitor
7) View System Data
8) Exit
 
Option? 6
1) Enable/Disable Health Monitor
2) View Alerts Records
3) Configure Health Monitor Classes
4) Set Health Monitor Options
5) Exit
 
Option? 3
1) Activate/Deactivate Rules
2) Configure Periods
3) Configure Charts
4) Edit Sensor Objects
5) Reset Defaults
6) Exit
 
Option? 4
1) List Sensor Objects
2) Edit Sensor Object
3) Exit
 
Option? 2
Sensor? ?
 
 Num  Sensor                         Threshold
:
  9)  DBLatency
 10)  DBReads
 11)  DBWrites
 12)  DiskPercentFull
: 
Sensor? 9 DBLatency
Base? 1000 => 
Alert Value? 3000 => 4000   <-- Alert(2) メッセージ出力レベルを 4000 に変更
Setting Max Multiplier and Warn Multiplier to 0. Enter a Warn Value
 
Warn Value? 1000 => 2000   <-- Warming(1) メッセージ出力レベルを 2000 に変更
Sensor object DBLatency updated.
Base           750
MaxMult        0
AlertValue     4000
WarnMult       0
WarnValue      2000
1) List Sensor Objects
2) Edit Sensor Object
3) Exit
 
Option?   <-- このあと全て <Enter> で抜ける

システムモニタを再開することで、設定したセンサオブジェクトの値が有効になります。

%SYS>do ^%SYSMONMGR
1) Start/Stop System Monitor
: 
Option? 1
1) Start System Monitor
2) Stop System Monitor
3) Exit
 
Option? 1
Starting System Monitor... System Monitor started
 
1) Start System Monitor
2) Stop System Monitor
3) Exit
 
Option?   <-- このあと全て <Enter> で抜ける

※変更可能なセンサオブジェクトの一覧は こちら をご覧ください。

Caché 用に作成された資料になりますが、以下で^%SYSMONMGRユーティリティについて詳しく説明をしています(IRISでも根本機能は同じです)。ぜひ参考になさってください。
モニタリングツールによるシステム監視(P.8~)

讨论 (0)0
登录或注册以继续
讨论 (2)1
登录或注册以继续