ChaterJee 0.2.5__py3-none-any.whl → 0.2.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ChaterJee/ChaterJee.py +3 -2
- {chaterjee-0.2.5.dist-info → chaterjee-0.2.7.dist-info}/METADATA +84 -14
- chaterjee-0.2.7.dist-info/RECORD +6 -0
- chaterjee-0.2.5.dist-info/RECORD +0 -6
- {chaterjee-0.2.5.dist-info → chaterjee-0.2.7.dist-info}/WHEEL +0 -0
- {chaterjee-0.2.5.dist-info → chaterjee-0.2.7.dist-info}/top_level.txt +0 -0
ChaterJee/ChaterJee.py
CHANGED
@@ -300,8 +300,9 @@ class NoteLogs:
|
|
300
300
|
else:
|
301
301
|
_logDIR = Path(logDIR)
|
302
302
|
|
303
|
-
|
304
|
-
|
303
|
+
if logSTRING is not None:
|
304
|
+
with open(_logDIR / logFILE, 'a') as ffa:
|
305
|
+
print(f"\n{logSTRING}",file=ffa)
|
305
306
|
|
306
307
|
_logFILE = _logDIR / logFILE
|
307
308
|
_logIMAGE = _logDIR / logIMAGE
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ChaterJee
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.7
|
4
4
|
Summary: Communicate your project updates via Telegram Bot!
|
5
5
|
Author: Pallab Dutta
|
6
6
|
Author-email: pallab9997@gmail.com
|
@@ -19,7 +19,13 @@ These are probably the most boring, time-consuming, yet unavoidable phases in ou
|
|
19
19
|
Let me introduce ChaterJee to you — a playful fusion of `Chater`, meaning one who chats, and `Jee`, an honorific used in Indian culture to show respect. Think of `ChaterJee` as the lab assistant you always wanted — one who actually responds, never crashes your code, doesn't ask for co-authorship, and definitely doesn't need coffee all the time, unlike you.
|
20
20
|
|
21
21
|
# Installation
|
22
|
-
|
22
|
+
As a prerequisite you are required to install the `jq` library for reading JSON files from bash script.
|
23
|
+
```bash
|
24
|
+
sudo apt update
|
25
|
+
sudo apt install jq
|
26
|
+
```
|
27
|
+
|
28
|
+
Now, you need two things:
|
23
29
|
1. The `ChaterJee` module
|
24
30
|
2. A telegram BOT that you own
|
25
31
|
|
@@ -60,27 +66,79 @@ https://api.telegram.org/bot123456789:ABCdefGhiJKlmNoPQRsTuvWXyz/getUpdates
|
|
60
66
|
- `ChatLogs` class: This reads log files, the last line is sent to you via the BOT. It can also share you final plots that you need for your next rerun.
|
61
67
|
|
62
68
|
## The minimal example
|
63
|
-
This will register your JOB with the given `
|
69
|
+
This will register your JOB with the given `JOBNAME` and logfiles into a JSON file, `<your home>/.data/JOB_status.json`.
|
64
70
|
|
71
|
+
`script.py`
|
65
72
|
```python
|
66
73
|
# This is a minimal example
|
74
|
+
|
75
|
+
# Your imports
|
76
|
+
from pathlib import Path
|
67
77
|
import ChaterJee
|
78
|
+
import json
|
68
79
|
|
69
80
|
# your code here
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
+
with open("hyperparams.json","r") as ffr:
|
82
|
+
HYPERPARAMS = json.load(ffr)
|
83
|
+
# get your parameters
|
84
|
+
JOBNAME = HYPERPARAMS["JOBNAME"]
|
85
|
+
LOGDIR = HYPERPARAMS["LOGDIR"]
|
86
|
+
LOGFILE = HYPERPARAMS["LOGFILE"]
|
87
|
+
LOGIMAGE = HYPERPARAMS["LOGIMAGE"]
|
88
|
+
|
89
|
+
notelogs = ChaterJee.NoteLogs()
|
90
|
+
notelogs.write(
|
91
|
+
jobNAME=JOBNAME,
|
92
|
+
logDIR=LOGDIR,
|
93
|
+
logFILE=LOGFILE,
|
94
|
+
logIMAGE=LOGIMAGE
|
95
|
+
)
|
96
|
+
|
97
|
+
### Your code that generates logs
|
98
|
+
print(f"{logs}")
|
99
|
+
|
100
|
+
### Your code that generates plot
|
101
|
+
logPath = Path(LOGDIR)
|
102
|
+
plt.savefig(logPath / LOGIMAGE)
|
103
|
+
```
|
104
|
+
|
105
|
+
The `hyperparams.json` file should look like the following. It must contain the last 4 `{key: value}` pairs to let our BOT access the log results.
|
106
|
+
|
107
|
+
`hyperparams.json`
|
108
|
+
```json
|
109
|
+
{
|
110
|
+
.
|
111
|
+
.
|
112
|
+
|
113
|
+
"JOBNAME": "model_2.4",
|
114
|
+
"LOGDIR": "./run_2.4",
|
115
|
+
"LOGFILE": "outFile.log",
|
116
|
+
"LOGIMAGE": "outImage.png"
|
117
|
+
}
|
118
|
+
```
|
119
|
+
Save the following script in your working directory to rerun your tuning experiments quickly.
|
120
|
+
|
121
|
+
`run.sh`
|
122
|
+
```bash
|
123
|
+
#!/bin/bash
|
124
|
+
|
125
|
+
# Path to hyperparameter file
|
126
|
+
hyparam_file="hyperparams.json"
|
127
|
+
|
128
|
+
# Read values from config.json using jq
|
129
|
+
stdout_log=$(jq -r '.LOGFILE' "$hyparam_file")
|
130
|
+
stdout_dir=$(jq -r '.LOGDIR' "$hyparam_file")
|
131
|
+
|
132
|
+
# Create log directory
|
133
|
+
mkdir -p "$stdout_dir"
|
134
|
+
|
135
|
+
# Run the Python script with redirected logs
|
136
|
+
nohup python script.py --hyprm "$hyparam_file" > "$stdout_dir/$stdout_log" 2> "$stdout_dir/error.log" &
|
137
|
+
```
|
81
138
|
|
82
139
|
Next step is to receive updates on your projects.
|
83
140
|
|
141
|
+
`updater.py`
|
84
142
|
```python
|
85
143
|
# Run this instance separately to parse job updates
|
86
144
|
# This is the one which actually communicates with your BOT.
|
@@ -94,3 +152,15 @@ if __name__ == '__main__':
|
|
94
152
|
cbot = ChaterJee.ChatLogs(TOKEN, CHATID)
|
95
153
|
cbot.cmdTRIGGER()
|
96
154
|
```
|
155
|
+
Run the above script in a separate terminal session to start interacting with your BOT.
|
156
|
+
|
157
|
+
## At your Telegram App
|
158
|
+
- Think your inbox as the terminal.
|
159
|
+
- `cd`, `ls` etc. works as expected. Therefore to go to parent directory, you simply type: `cd ..` , and to list contents type `ls` . You can run the `run.sh` executable just by typing `./run.sh` .
|
160
|
+
- texts starting with `/` are telegram-BOT commands.
|
161
|
+
|
162
|
+
At this stage the following 4 commands work:
|
163
|
+
- `/start` : Starts the conversation with the BOT.
|
164
|
+
- `/jobs` : List the jobs as Keyboard button options.
|
165
|
+
- `/clear` : Clears the chat history once you allow.
|
166
|
+
- `/edit file.json` : Let you edit and save the JSON file by the webapp Editor Babu.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
ChaterJee/ChaterJee.py,sha256=oTSXbCSpfXB8f9m7ErXSFMlgGayGifI8FUHRa2DeFDg,12995
|
2
|
+
ChaterJee/__init__.py,sha256=tZmkZY2XbzJ8rHDh8nOmb1W73kPecPv3xcEiCPwkZf4,98
|
3
|
+
chaterjee-0.2.7.dist-info/METADATA,sha256=AlMpY3NNrzmlfUx5_1DfvBCAWxb4vA_l9e1bIECrtOw,5872
|
4
|
+
chaterjee-0.2.7.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
5
|
+
chaterjee-0.2.7.dist-info/top_level.txt,sha256=Z1UAYoaNybpDiKjqa1yFpti_q0FNECVItb3-9yAh3gM,10
|
6
|
+
chaterjee-0.2.7.dist-info/RECORD,,
|
chaterjee-0.2.5.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
ChaterJee/ChaterJee.py,sha256=xBOSlGLH0O15W6ZtPvCFfBug1dlyQ4p6g7yFwwPxjBw,12953
|
2
|
-
ChaterJee/__init__.py,sha256=tZmkZY2XbzJ8rHDh8nOmb1W73kPecPv3xcEiCPwkZf4,98
|
3
|
-
chaterjee-0.2.5.dist-info/METADATA,sha256=bELxgqCxoIxuQ8inkpEfVJRqKs3RrQC6bpZZa9W3KOs,3844
|
4
|
-
chaterjee-0.2.5.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
5
|
-
chaterjee-0.2.5.dist-info/top_level.txt,sha256=Z1UAYoaNybpDiKjqa1yFpti_q0FNECVItb3-9yAh3gM,10
|
6
|
-
chaterjee-0.2.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|