Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG  Not logged in ELOG logo
icon5.gif   propogating messages through logbooks, posted by kenzo Abrahams on Thu Oct 29 12:30:43 2015 
    icon2.gif   Re: propogating messages through logbooks, posted by Andreas Luedeke on Fri Oct 30 15:52:33 2015 
       icon2.gif   Re: propogating messages through logbooks, posted by kenzo Abrahams on Mon Nov 2 07:39:07 2015 elogd.cfgextractTable.py
          icon2.gif   Re: propogating messages through logbooks, posted by kenzo Abrahams on Mon Nov 2 08:37:06 2015 
Message ID: 68174     Entry time: Mon Nov 2 07:39:07 2015     In reply to: 68172     Reply to this: 68175
Icon: Reply  Author: kenzo Abrahams  Author Email: kenzoabrahams@gmail.com 
Category: Question  OS: Linux  ELOG Version: 3.1.1 
Subject: 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  863 Bytes  | Hide | Hide all
[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  1 kB  | Hide | Hide all
#!/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
ELOG V3.1.5-fe60aaf