Is possible to run task parallel

121 views
Skip to first unread message

Vijay A

unread,
Jan 4, 2024, 4:32:14 AM1/4/24
to go-cd

I have installed GoCD server. And Installed one GoCD Agent.

Now i created a new pipeline : Pipeline1

Created one stage : Stage1

Now two jobs: Job1 and Job2

As i am having one GoAgent, does these two jobs will be executed parallely.is there any way to achieve this ? 

Sriram Narayanan

unread,
Jan 4, 2024, 4:40:42 AM1/4/24
to go...@googlegroups.com
No

Yes, add a second good agent. Ensure that both the go agents and The job are marked as the same “resource”. 


--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/b832fcba-6af7-4516-8420-3e97055bf486n%40googlegroups.com.

Chad Wilson

unread,
Jan 4, 2024, 4:55:20 AM1/4/24
to go...@googlegroups.com
Indeed, you need the ability to have multiple agents running in parallel to be able to do multiple jobs in parallel. The best way to achieve this depends on 1) your installation/deployment choice 2) your agent requirements 3) whether you are experimenting or thinking about a production deployment.

If you want to use "static" agents directly as processes at OS level, there is https://docs.gocd.org/current/advanced_usage/admin_install_multiple_agents.html

Otherwise you can use "elastic" (dynamically created) agents via a plugin, e.g to run multiple agents on a single host within Docker (here), or if you are familiar with Kubernetes running GoCD or its agents inside Kubernetes (use either multiple static agents, or elastic agents - even for experimenting locally).

-Chad

Vijayakumaran A.

unread,
Jan 4, 2024, 8:25:16 AM1/4/24
to go-cd
Thanks.so we can't run multiple stage with one agent.but  Is there any possibilities to run the GOCD Task parallely? i have submit my pipeline code here i have one stage with one job 5 task(commands)..i wanted to run all my task(commands) parallel.Please find my attachment here. 
CFS.gocd.yaml

Tsanko Stoev

unread,
Jan 4, 2024, 3:26:45 PM1/4/24
to go...@googlegroups.com
If you are executing a command you should be able to use ; to execute multiple commands concurrently. For example : "command1 ; command2 ; command3" .
I believe this should work on Windows and Linux. 
Thanks.

Tsanko Stoev 
 

Alexey Savchkov

unread,
Jan 5, 2024, 3:58:38 AM1/5/24
to go-cd
@Tsanko Stoev No, the semicolon simply produces a list of commands which are still executed in turn, see e.g `man sh` of `man bash` for the explanation of lists

E.g. from `man bash`: "Commands  separated  by  a  ; are executed sequentially".

In theory you could run shell tasks in parallel by ending their commands with an "&" and thus sending them immediately to the background but this has little practical usage because their execution will be completely detached from GoCD and you will bw unable to check their exit status, collect artifacts and so on.

GoCD pipeline model is that tasks always run sequentially and jobs (sets of tasks) always run in parallel. I would very much like to optionally control the order of execution of jobs within one stage (for cases one of which I e.g. decribed here https://groups.google.com/g/go-cd/c/39YZN8ejEig/m/AXLIC3-RBAAJ), but even in its current form the model makes reasonable sense.
 
@Vijayakumaran Your pipeline looks like your php74 runs are independent bits of work rather than consecutive steps relying on each other. Turn your php74 tasks into jobs and probably you will immediately get what you have in mind. Note, however, that the YAML format is little suitable for working with parallelism. Use the Groovy format where your parallel jobs can be implemented as simple as creating a list of your arguments and iterating over this list when declaring the job element.

As an illustration I attach my own case of running the same set of tests against multiple versions of PostgreSQL in parallel. This is done by using jobs.
parallel-jobs.png
пятница, 5 января 2024 г. в 03:26:45 UTC+7, Tsanko Stoev:
Reply all
Reply to author
Forward
0 new messages