[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [modeller_usage] Use $SGE_TASK_ID in the python script



On 5/13/21 8:05 AM, ZHANG Cheng wrote:
random_integer = int(-1*str($SGE_TASK_ID)[-4:])
                                           ^
SyntaxError: invalid syntax

So is that possible to use the job ID (e.g. 7172646) as an variable in the python environment? Thank you!

A simple Google search tells you the answer; here's one hit:
https://www.askpython.com/python/environment-variables-in-python

In your case, you want to use os.environ['SGE_TASK_ID'] rather than $SGE_TASK_ID.

	Ben Webb, Modeller Caretaker
--
             https://salilab.org/modeller/
Modeller mail list: https://salilab.org/mailman/listinfo/modeller_usage