CGRU / cgru

CGRU - AFANASY
http://cgru.info/
GNU Lesser General Public License v3.0
278 stars 111 forks source link

Adding custom menus to afwatch #601

Closed andrey214 closed 6 months ago

andrey214 commented 6 months ago

Additional menus and tools for Afwatch

When you right-click on a task, job, or block, menu appears

How it works: $CGRU_LOCATION/afanasy/bin/afwatch_config/ and ~/afwatch_config/ It can contain menu description files in json format. The file name defines the name in the menu. Inside the file, the description is divided into 3 parts, such us job,block and task. Each part can have its own set of tools. Name and order of the tool inside json defines the name and sequence number in the menu.

Keys of tool: "cmd" - the command that is executed when you click. "arg" - Allows you to set arguments for a command from a set of predefined variables.It is passed to the command application as a single string argument.It can be either a direct link to the executable file or an application added to the PATH variable. "when_done" - allows you to select a tool only if the job block on the farm has been completed. "multi" - Determines whether the tool can be run recursively on a set of selected blocks or jobs. "service" - Sets a restriction on which services the tool can be run with.

Predefined Variables: "CGRU_LOCATION":"path from CGRU_LOCATION environment variable ", "STAGE": "job or block or task", "SINGLE": "for single menu item", "DEBUG": "Debug mode", "JOB_ID": "job id", "BLOCK_ID": "block id", "TASK_ID": "task id", "DONE": "is work item done"

json pseudo code:

{ "predefined":{ "CGRU_LOCATION":"path from CGRU_LOCATION environment variable ", "STAGE": "job or block or task", "SINGLE": "for single menu item", "DEBUG": "Debug mode", "JOB_ID": "job id", "BLOCK_ID": "block id", "TASK_ID": "task id", "DONE": "is work item done" }, "environs":{ "MY_ENV_1":"dfdf"
}, "paths":{ }, "actions":{ "job": { "tool1":{ "cmd": "python ./path_to_scripts/tool1.py", "arg": "\"{JOB_ID}|{BLOCK_ID}|{TASK_ID}\"", "multi": 1, "when_done": 1, "service":["nuke","karma","mantra","arnold","hython","hbatch","hbatch_pdg","htracker"]
} }, "block": { "tool2":{ "cmd": "python ./path_to_scripts/tool2.py", "arg": "\"{JOB_ID}|{BLOCK_ID}|{TASK_ID}\"", "service":["nuke","karma","mantra","arnold","hython","hbatch","hbatch_pdg","htracker"]
} }, "task": { "tool3":{ "cmd": "python ./path_to_scripts/tool3.py", "arg": "\"{JOB_ID}|{BLOCK_ID}|{TASK_ID}\"", "service":["nuke","karma","mantra","arnold","hython","hbatch","hbatch_pdg","htracker"]
} } } }

lithorus commented 6 months ago

No offense, but this seems to be touching way too many things for just being for afwatch.

Also what is this cinemotion thing?

And why are there so many hardcoded paths for you home directory?

I would start by discussing what the format should be for the config file before considering how to implement it.

The patch is WAY to messy IMO.

lithorus commented 6 months ago

Start by opening a feature request for the custom menus...

timurhai commented 6 months ago

In this request I see lots of hard coded things for a particular studio. So many changes... Most changes are not related to this issue. (I even has not noticed this issue related changes among this mess) Changing code so much is not a good idea, how you will switch to 3.4.0?

ps Very bad pull request. Lots of .sh and .cmd files changed to build in your studio paths. Some files changed just tabs to spaces or spaces to tabs.

pps Commenting this you let afanasy compile on platform that it can work incorrectly later:

-   compile_assert(sizeof(m_data) >= sizeof(pthread_mutex_t));
+// compile_assert(sizeof(m_data) >= sizeof(pthread_mutex_t));

You should set valid sizes for supported platforms here: https://github.com/CGRU/cgru/blob/master/afanasy/src/libafanasy/common/dlMutex.h#L43

lithorus commented 6 months ago

Having custom menu items is a good idea though. How it's implemented is just something that needs to be discussed. If you create a feature request, we can discuss it there.