ecmwf / ecflow

ECMWF's workflow manager
Apache License 2.0
40 stars 15 forks source link

the '.ecf' related questions. #11

Closed 19950813 closed 11 months ago

19950813 commented 2 years ago
iainrussell commented 2 years ago

Hello @19950813, Yes, tasks can be written in Python, though it is not as common as using shell script - there is some documentation on how to do it here: https://confluence.ecmwf.int/display/ECFLOW/Native+Python+Tasks

Cheers, Iain

19950813 commented 2 years ago

@iainrussell Thanks.

19950813 commented 2 years ago

@iainrussell Hello, the screenshot part is reporting an error in my editor, what is the matter? Do I need to deal with it and try to run it, but it is also a running error, what should I do? WechatIMG341

WechatIMG340

iainrussell commented 2 years ago

Hi @19950813 , looks like you forgot the quote marks, plus there are spaces after the %. It should surely be "%ECF_TRYNO%"

I don't have direct experience of using ECF_MICRO, but I looked here: https://confluence.ecmwf.int/display/ECFLOW/ECF_MICRO and I'd say that to set it in Python you'd need to add a variable in the definition setup, with name ECF_MICRO and value "#" if you want to use '#' as the ecf_micro character. In you case it does not really seem necessary, as you should be able to 'escape' it by using %%, e.g. strftime('%%H:%%M:%%S')

19950813 commented 2 years ago

Hi @iainrussell ,Sorry, I haven't paid attention to this issue recently. I just saw it today. The above screenshot is copied directly from the document you sent me, including these places where the grammar is wrong. Please take a look at it carefully, please.

iainrussell commented 2 years ago

Hello @19950813,

That's strange - when I look at page https://confluence.ecmwf.int/display/ECFLOW/Native+Python+Tasks, I see this: image and the %ECF_TRYNO% does not have spaces within it. So looks like an error has crept in on your side.

Probably the second highlighted line should be ok.

Note that this Python script is not intended to be run as it is - it is intended to be run by ecFlow, which will substitute these %% variables with their actual values - the result should be a runnable Python script.