ID |
Date |
Icon |
Author |
Author Email |
Category |
OS |
ELOG Version |
Subject |
68174
|
Mon Nov 2 07:39:07 2015 |
| kenzo Abrahams | kenzoabrahams@gmail.com | Question | Linux | 3.1.1 | Re: propogating messages through logbooks |
> Hi Kenzo,
> I think it would help me to understand your problem, if you would provide a minimal configuration file with two
> logbooks.
>
> There is no ELOG internal feature to propagate data from one logbook to another;
> using a shell script is the only method I know.
> But you could easily put your script into the background:
> ELOG can handle multiple parallel request, by handling one request after the other.
>
> Kind Regards, Andreas
Hi Andreas
Im using python to do the scripting. Everything works fine until it comes to submitting the entry to my logbook.
The extractTable.py file is the one running the command to submit to elog.
I see now that im starting a subprocess in my python script (subprocess.call) and thats why its not finishing.
Could you perhaps suggest how I would go about doing this by putting my scripts in the
background? I might have to look at multiprocessing in python as well. The reason im using python is because im
doing alot of file processing as well. I do have to add that this method works perfectly when i just run the python
on its own. As soon as i run it by submiting an elog entrie from the browser it hangs on the subprocess.call method.
Regards, Kenzo |
Attachment 1: elogd.cfg
|
[global]
Group Ithemba = Configuration, Maintenance
Group Maintenance = C1
port = 8080
[Configuration]
Theme = default
Comment = Current configuration of detectors
Attributes = Author, Subject
Preset Subject = Current Configuration
Required Attributes = Author
Locked Attributes = Author, Subject
Page Title = ELOG - $subject
Reverse sort = 1
Quick filter = Date
Execute new = $shell(echo "$message id" &> /usr/local/elog/logbooks/ID.txt; python /usr/local/elog/logbooks/lookupConfig.py; python /usr/local/elog/logbooks/extractTable.py)
[C1]
theme = default
Comment = Maintenance information for clover detector C1
Attributes = Author, Subject, Type
Options Type = Defects, Routine, Problem Fixed, Maintenance
Preset Author = $long_name
Required Attributes = Author
Locked Attributes = Author
Page Title = ELOG - $subject
Reverse sort = 1
Quick filter = Date
|
Attachment 2: extractTable.py
|
#!/usr/bin/python
from bs4 import BeautifulSoup
import sys
import re
import time
import csv
import subprocess
#time.sleep(2)
counter = 0
DetectorNum = 1
soup = BeautifulSoup(open('/usr/local/elog/logbooks/Table.html'), 'html5lib')
for table in soup.find_all('table'):
for row in table.find_all('tr'):
col = row.find_all('td')
Xia = col[0].string
module = col[1].string
channel = col[2].string
name = col[3].string
arrayPos = col[4].string
panel = col[5].string
if counter == 0:
titleList = (str(Xia), str(module), str(channel), str(name), str(arrayPos), str(panel))
counter = counter + 1
else:
record = (str(Xia), str(module), str(channel), str(name), str(arrayPos), str(panel))
file = open('/usr/local/elog/logbooks/tableData', 'w')
for i in range(len(titleList)):
file.write(str(titleList[i])+" = "+str(record[i])+"\n")
file.close()
DetName = "C"+str(DetectorNum)
subprocess.call(["elog", "-h", "localhost", "-p", "8080", "-l", DetName, "-u", "System", "password", "-a", "Author=System", "-a", "Subject=\"testing the auto writing of detectors\"", "-m", "/usr/local/elog/logbooks/tableData"])
counter = counter + 1
DetectorNum = DetectorNum + 1
|
68173
|
Fri Oct 30 18:20:22 2015 |
| Kester Habermann | kester.habermann@gmail.com | Bug report | All | 3.1.1 | restrict edit time and autosave | Hello,
When using restrict edit time together with autosave, there is the following problem: The counter for restrict edit time seems to start after the autosave. If the time is up, it is no longer possible to submit the report.
It is also not possble to edit old drafts if restrict edit has elapsed since the creation of the save.
Autosave is definitively a nice new feature. However, I think it would be better if the counter for restrict edit time only started after the "submit" of the report and allowed edits to drafts no matter how old they are. As it is one needs to either set a really high value for restrict edit time or turn off autosave.
The issue seems to be related to: https://midas.psi.ch/elogs/Forum/68103
Regards
Kester
|
68172
|
Fri Oct 30 15:52:33 2015 |
| Andreas Luedeke | andreas.luedeke@psi.ch | Question | Linux | 3.1.1 | Re: propogating messages through logbooks | > Hi there
>
> Okay so let me explain what im trying to do. I have a table in a logbook (lets call it home) that the user fills
> out. This information in the table is related to other logbooks (8 of them to be exact).
> I want to propogate information from the table in the home logbook into the other logbooks. To do this I used
> Execute new which runs my scripts. One of the scripts makes a call to the elog
> client to submit the message. The problem is that this call to elog client never finishes because its hanging
> waiting for the initial submit (one which triggered Execute new) to finish. The documentation
> explained that only one submit can be processed at a time so i expected whats happening at the moment.
>
> My question is are there any other ways to do what im trying to do?? In a nutshell how to propogate information
> from one logbook to another autonomously.
>
> Regards
> Kenzo
Hi Kenzo,
I think it would help me to understand your problem, if you would provide a minimal configuration file with two
logbooks.
There is no ELOG internal feature to propagate data from one logbook to another;
using a shell script is the only method I know.
But you could easily put your script into the background:
ELOG can handle multiple parallel request, by handling one request after the other.
Kind Regards, Andreas |
68171
|
Thu Oct 29 12:30:43 2015 |
| kenzo Abrahams | kenzoabrahams@gmail.com | Question | Linux | 3.1.1 | propogating messages through logbooks | Hi there
Okay so let me explain what im trying to do. I have a table in a logbook (lets call it home) that the user fills
out. This information in the table is related to other logbooks (8 of them to be exact).
I want to propogate information from the table in the home logbook into the other logbooks. To do this I used
Execute new which runs my scripts. One of the scripts makes a call to the elog
client to submit the message. The problem is that this call to elog client never finishes because its hanging
waiting for the initial submit (one which triggered Execute new) to finish. The documentation
explained that only one submit can be processed at a time so i expected whats happening at the moment.
My question is are there any other ways to do what im trying to do?? In a nutshell how to propogate information
from one logbook to another autonomously.
Regards
Kenzo |
68170
|
Wed Oct 28 11:11:27 2015 |
| kenzo Abrahams | kenzoabrahams@gmail.com | Question | Linux | 3.1.1 | Re: running more then one shell command when new entries is submitted | Hi Andreas
This worked perfectly thank you.
Andreas Luedeke wrote: |
As far as I know ELOG is recognising a configuration line as a comment only when it starts with a ';'.
I can assure you that ELOG does not treat the rest of the line as a comment when you use a ';' within a $shell() command: I do it a lot and it works fine. Here's a simple, generic example using the bash:
Preset Author = $shell(if [ $short_name = "Anonym" ] ;then echo $Author;else echo \"$long_name, $Author\";fi)
It adds $long_name to the Author field for non-anonymous entries.
Cheers Andreas
kenzo Abrahams wrote: |
If i put the ';' into Execute the rest of the command becomes a comment thats why i was trying to use '&&' instead. If I encapulate the whole command in "" or '' then both commands are executed but the files im trying to write to gets created but no data is piped into it. When I use Execute with one command and pipe its output to a file everything works fine though.
Stefan Ritt wrote: |
The command is passed to your shell, and some shells except more than one command. Most Linux shells accept commands separated by ';', which you can try yourself by entering for example: ls *.c; ls*.h
kenzo Abrahams wrote: |
Hi
Im just curious is it possible to run more then one command using Execute new = <command> or will i have to run a script to run muliple commands.
I tried using '&&' to seperate more then one command but it seems that the first one only gets executed and the rest are just ignored.
Regards
Kenzo
|
|
|
|
|
68169
|
Wed Oct 28 09:15:52 2015 |
| Dani | droldan@cells.es | Question | Linux | 3.1.1 | Re: dynamic "preset text" option without remplace text if it has changed | thanks Andres for your response!
I was thinking that it cannot be possible, but , I had to try to ask in the forum.
for my question, I think that this could be left on user responsibility to take care about it, and add a comment the the text fied, explaining that will be erased the html text on change the text field.
Thanks four your time.
Andreas Luedeke wrote: |
I don't think that this is possible.
And it is not clear to me, how you would like it to work: I often use HTML tables in preset text, where the user should fill out columns (e.g. for checklists). I wouldn't want the tables just to append when switching to another checklist. You could rather add a comment to the Type field, explaining that the text field will be overwritten when you change the type.
The Firefox addon Lazarus does store whatever you've typed in an HTML form: at least you could then recover what you've typed.
Cheers, Andreas
Dani wrote: |
Dear all,
Is it possible to have a dynamic "preset text" option without remplace text if it has changed?
I would like to switch the template file depending on the attribute value (Type).
If user already started editing the text body, on change (Type) he could lose this data.
I'm using this example code :
Attributes = Type, Subject
Options Type = One{1}, Two{2}, Three{3}
Show text = 0
{1} Preset text = text1
{2} Preset text = text2
{3} Preset text = text3
{1,2,3} Show text = 1
I the attribute type change the user lost the data, because the text has been replaced.
Any idea about how to solve it?
Thanks!
Cheers
|
|
|
68168
|
Wed Oct 28 08:51:17 2015 |
| Andreas Luedeke | andreas.luedeke@psi.ch | Question | Linux | 3.1.1 | Re: dynamic "preset text" option without remplace text if it has changed | I don't think that this is possible.
And it is not clear to me, how you would like it to work: I often use HTML tables in preset text, where the user should fill out columns (e.g. for checklists). I wouldn't want the tables just to append when switching to another checklist. You could rather add a comment to the Type field, explaining that the text field will be overwritten when you change the type.
The Firefox addon Lazarus does store whatever you've typed in an HTML form: at least you could then recover what you've typed.
Cheers, Andreas
Dani wrote: |
Dear all,
Is it possible to have a dynamic "preset text" option without remplace text if it has changed?
I would like to switch the template file depending on the attribute value (Type).
If user already started editing the text body, on change (Type) he could lose this data.
I'm using this example code :
Attributes = Type, Subject
Options Type = One{1}, Two{2}, Three{3}
Show text = 0
{1} Preset text = text1
{2} Preset text = text2
{3} Preset text = text3
{1,2,3} Show text = 1
I the attribute type change the user lost the data, because the text has been replaced.
Any idea about how to solve it?
Thanks!
Cheers
|
|
68167
|
Tue Oct 27 15:41:57 2015 |
| Dani | droldan@cells.es | Question | Linux | 3.1.1 | dynamic "preset text" option without remplace text if it has changed | Dear all,
Is it possible to have a dynamic "preset text" option without remplace text if it has changed?
I would like to switch the template file depending on the attribute value (Type).
If user already started editing the text body, on change (Type) he could lose this data.
I'm using this example code :
Attributes = Type, Subject
Options Type = One{1}, Two{2}, Three{3}
Show text = 0
{1} Preset text = text1
{2} Preset text = text2
{3} Preset text = text3
{1,2,3} Show text = 1
I the attribute type change the user lost the data, because the text has been replaced.
Any idea about how to solve it?
Thanks!
Cheers |
|