Open AritraBasuPol opened 11 months ago
Unfortunately not at present
We can possibly just add a timestamp to the log filename though as well.
A workaround would be to mount the file somewhere else on your containerization platform before running. This can be done using -v when using podman or docker. Not sure what the switches are for apptainer, it may be in a configuration file if memory serves.
On Wed, Dec 27, 2023, 22:16 AritraBasuPol @.***> wrote:
Is there an argument parser so that the default logfile, "tricolour.log", can be chosen by an user? Tricolour crashes if multiple users on a machine is executing tricolour from the same path. This is because different users do not have write permission on a file created by another user, even if they belong to the same group.
Paste the command(s) you ran and the output. If there was a crash, please include the traceback here.
Singularity meerkat.simg:/data/mgps> tricolour Unexpected error. Dropping you into pdb for a post-mortem. Traceback (most recent call last): File "/usr/local/bin/tricolour", line 11, in load_entry_point('tricolour==0.1.8', 'console_scripts', 'tricolour')() File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 490, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2854, in load_entry_point return ep.load() File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2445, in load return self.resolve() File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2451, in resolve module = import(self.module_name, fromlist=['name'], level=0) File "/usr/local/lib/python3.8/dist-packages/tricolour-0.1.8-py3.8.egg/tricolour/apps/tricolour/app.py", line 80, in log = create_logger() File "/usr/local/lib/python3.8/dist-packages/tricolour-0.1.8-py3.8.egg/tricolour/apps/tricolour/app.py", line 65, in create_logger filehandler = logging.FileHandler("tricolour.log") File "/usr/lib/python3.8/logging/init.py", line 1147, in init StreamHandler.init(self, self.open()) File "/usr/lib/python3.8/logging/_init.py", line 1176, in _open return open(self.baseFilename, self.mode, encoding=self.encoding) PermissionError: [Errno 13] Permission denied: '/data/mgps/tricolour.log'
— Reply to this email directly, view it on GitHub https://github.com/ratt-ru/tricolour/issues/92, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4RE6WUIYSFSI6I3NHJHSDYLR6YBAVCNFSM6AAAAABBEXASIGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TONZUGI4TINQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thanks Ben Hugo, Yes, adding timestamp would work perfectly. This is indeed what our strategy was expected to be, if a simple argument could have been parser.
For this, is it sufficient to change the follwoing, in app.py
def create_logger(): """ Create a console logger """ log = logging.getLogger("tricolour") log.setLevel(logging.DEBUG) filehandler = logging.FileHandler("tricolour.log")
to something like:
def createlogger(): """ Create a console logger """ fileAppend = subprocess.getoutput(('date +%b%d%Y%T')) log = logging.getLogger("tricolour") log.setLevel(logging.DEBUG) filehandler = logging.FileHandler("tricolour%s.log" %fileAppend)
Will making this change be sufficient, or do we have to change this elsewhere? Also, will any new updated version be available anytime soon with this implemented?
Should work. I don't recall modifying the logging anywhere else now.
Unfortunately won't be able to get to this till well into January -- I'm busy with part time studies at the moment.
On Thu, Dec 28, 2023 at 1:31 PM AritraBasuPol @.***> wrote:
Thanks Ben Hugo, Yes, adding timestamp would work perfectly. This is indeed what our strategy was expected to be, if a simple argument could have been parser.
For this, is it sufficient to change the follwoing, in app.py
def create_logger(): """ Create a console logger """ log = logging.getLogger("tricolour") log.setLevel(logging.DEBUG) filehandler = logging.FileHandler("tricolour.log")
to something like:
def createlogger(): """ Create a console logger """ fileAppend = subprocess.getoutput(('date +%b%d%Y%T')) log = logging.getLogger("tricolour") log.setLevel(logging.DEBUG) filehandler = logging.FileHandler("tricolour%s.log" %fileAppend)
Will making this change be sufficient, or do we have to change this elsewhere? Also, will any new updated version be available anytime soon with this implemented?
— Reply to this email directly, view it on GitHub https://github.com/ratt-ru/tricolour/issues/92#issuecomment-1871080299, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4RE6XTOA27ABGC7ZHOW2DYLVKC3AVCNFSM6AAAAABBEXASIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGA4DAMRZHE . You are receiving this because you commented.Message ID: @.***>
Benjamin Hugo
Thanks. We will implement the patch locally and look forward to the updated version.
Best wishes, Aritra.
Upcoming release should make this configurable - see commit 3aff237
Is there an argument parser so that the default logfile, "tricolour.log", can be chosen by an user? Tricolour crashes if multiple users on a machine is executing tricolour from the same path. This is because different users do not have write permission on a file created by another user, even if they belong to the same group.
Singularity meerkat.simg:/data/mgps> tricolour Unexpected error. Dropping you into pdb for a post-mortem. Traceback (most recent call last): File "/usr/local/bin/tricolour", line 11, in
load_entry_point('tricolour==0.1.8', 'console_scripts', 'tricolour')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2451, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python3.8/dist-packages/tricolour-0.1.8-py3.8.egg/tricolour/apps/tricolour/app.py", line 80, in
log = create_logger()
File "/usr/local/lib/python3.8/dist-packages/tricolour-0.1.8-py3.8.egg/tricolour/apps/tricolour/app.py", line 65, in create_logger
filehandler = logging.FileHandler("tricolour.log")
File "/usr/lib/python3.8/logging/init.py", line 1147, in init
StreamHandler.init(self, self.open())
File "/usr/lib/python3.8/logging/_init.py", line 1176, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: '/data/mgps/tricolour.log'