DIRAC icon indicating copy to clipboard operation
DIRAC copied to clipboard

Add documentation on how to write scripts that interact with DIRAC

Open chaen opened this issue 2 years ago • 1 comments

Basically document the initialize() or parseCommandLine() magic

Discussed in https://github.com/DIRACGrid/DIRAC/discussions/7114

Originally posted by IgorPelevanyuk July 21, 2023 Hello,

In version 8 the idea behind development of scripts changed a bit. It looks like it is necessary to include all developed scripts in special console_scripts variable in setup.cfg. Without that the script will throw an error "Something is very wrong" from https://github.com/DIRACGrid/DIRAC/blob/1cd1173303b177dbfe44ede43d18d25514713301/src/DIRAC/Core/Base/Script.py#L55C40-L55C63

My question is the following. How to write a custom python script that use DIRAC API and that may be distributed with a job to be executed during userjob execution?

chaen avatar Jul 24 '23 07:07 chaen

My question is the following. How to write a custom python script that use DIRAC API and that may be distributed with a job to be executed during userjob execution?

I think this should work:

import DIRAC
DIRAC.initialize()
# All remaining DIRAC imports

chrisburr avatar Jul 27 '23 09:07 chrisburr