Closed HuangFuSL closed 1 year ago
Unfortunately, I don't think introducing random behaviour into the placeholders is a good idea. Too easy to produce bugs that are hard to reproduce.
As to the pre- and post-recipe tool, may I know what is preventing the creation of a large recipe that includes all the steps?
Have you considered using the external build command mechanism, see https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile#external-build-command?
It is not completely clear to me what you try to achieve, but it may help.
Thanks for taking time to reply!
Unfortunately, I don't think introducing random behaviour into the placeholders is a good idea. Too easy to produce bugs that are hard to reproduce.
I see, I'll try other workarounds for uuid
. But still thanks for the reply!
As to the pre- and post-recipe tool, may I know what is preventing the creation of a large recipe that includes all the steps?
@James-Yu For pre- and posts-, the first step of my workflow is to create a temporary directory and the last one is to remove it.
CreateTemp -> A -> B -> C -> D -> RemoveTemp
It does work when all the tasks exited normally. But when the recipe fails in some step, the final cleaning stage RemoveTemp
will not be executed.
CreateTemp -> A -> B -X-> C -X-> D -X-> RemoveTemp
With postRecipe
implemented, we can move RemoveTemp
to postRecipe
to ensure it will be executed even if the workflow fails. But still, it's not so important since these steps can be executed manually.
Have you considered using the external build command mechanism, see https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile#external-build-command?
@jlelong No... I didn't realize the existence of the feature. 🥲 My workflow is something like this:
{
"name": "RemoteXeLaTeX",
"command": "docker",
"args": [
"--context",
"remote",
"run",
"--pull",
"always",
"-i",
"--rm",
"-v",
"/data/document:/data",
"ghcr.io/huangfusl/template:latest",
"xelatex",
"%DOCFILE%",
"%DOCFILE_EXT%"
]
}
I've checked the documentation here, but I'm not quite clear how to use the external commands. As far as I understand, it invokes a single command and will be suitable for scripted build process. Sadly such is not my workflow. But still thanks for your reply, maybe I can alter to scripted workflow, which might be better in my case.
Pre-checks*
The Missed*
My recipe can be described as follows. My another problem is that if a recipe fails in some step, the following cleaning steps will not be executed (although not so important since I can attach inside container and manually remove these files).
entrypoint.sh clean "$2"
%DIR%
to/data/"$2"
(by executingdocker cp
)entrypoint.sh xelatex ...
twice/data/"$2"/output
back to %DIR%entrypoint.sh clean "$2"
I think we can add extra execution procedures like
preRecipe
andpostRecipe
for recipes.The Solution*
Anything Else?