Error: only ramping-vus or ramping-arravial-rate supports stages

Hi still learning about k6 and trying multiple scenarios script. But ran into the error but my constant-arrival-rate executor isn’t using stages only ramping-vus is. So why the error ?

k6 v0.40.0 (2022-09-08T09:06:02+0000/v0.39.0-92-gdcbe2f9c, go1.18.6, linux/amd64)

When I run

taskset -c 0-3 k6 run -e RPS=${REQRATE} -e USERS=${VU} -e STAGETIME=${TIME}s -e STAGE_VU1=${STAGEVU1} -e STAGE_VU2=${STAGEVU2} -e STAGE_VU3=${STAGEVU3} -e STAGE_VU4=${STAGEVU4} -e URL=$DOMAIN --no-usage-report --out influxdb=http://localhost:8186/k6 benchmark-scenarios-multi.js

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: benchmark-scenarios-multi.js
     output: InfluxDBv1 (http://localhost:8186)

  scenarios: (100.00%) 2 scenarios, 1000 max VUs, 57s max duration (incl. graceful stop):
           * constant_arrival_rate: 100.00 iterations/s for 5s (maxVUs: 0-1000, gracefulStop: 30s)
           * ramping_vus: Up to 300 looping VUs for 20s over 4 stages (gracefulRampDown: 0s, startTime: 37s, gracefulStop: 30s)

I get

ERRO[0002] Error: only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.
running at i (webpack://k6-jslib-utils/./src/stages.js:92:8(61))
constantat u (webpack://k6-jslib-utils/./src/stages.js:114:26(8))
ramping_at file:///root/tools/k6/benchmark-scenarios-multi.js:142:2(8)
        at native  executor=constant-arrival-rate scenario=constant_arrival_rate source=stacktrace
  scenarios: {
    constant_arrival_rate: {
      executor: 'constant-arrival-rate',
      startTime: '0s',
      rate: `${__ENV.RPS}`,
      timeUnit: '1s',
      duration: `${__ENV.STAGETIME}`,
      preAllocatedVUs: `${__ENV.USERS}`,
      maxVUs: 1000,
      gracefulStop:     '30s',
      tags: { executor: 'constant-arrival-rate' },
    },
    ramping_vus: {
      executor: 'ramping-vus',
      startTime: `${__ENV.STAGETIME + 32}s`,
      startVUs: `${__ENV.USERS}` || 0,
      stages: [
        { duration: `${__ENV.STAGETIME}`, target: `${__ENV.STAGE_VU1}` },
        { duration: `${__ENV.STAGETIME}`, target: `${__ENV.STAGE_VU2}` },
        { duration: `${__ENV.STAGETIME}`, target: `${__ENV.STAGE_VU3}` },
        { duration: `${__ENV.STAGETIME}`, target: `${__ENV.STAGE_VU4}` },
      ],
      gracefulRampDown: '0s',
      gracefulStop:     '30s',
      tags: { executor: 'ramping-vus' },
    },
  },

Hi @eva2000,
welcome to the community forum :tada:

I tried your options with static values and k6 works as expected for me. Can you try posting the same configuration with static values and without taskset that generates the issue for you, please?

2 Likes

Yeah with static values and without taskset, still got the issue below. Here’s the version of benchmark-scenarios-multi.js I am using.

k6 run -e RPS=1 -e USERS=0 -e STAGETIME=3s -e STAGE_VU1=25 -e STAGE_VU2=50 -e STAGE_VU3=100 -e STAGE_VU4=0 -e URL=https://domain1.com --no-usage-report --out json=summary-raw-scenarios-multi.gz benchmark-scenarios-multi.js

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: benchmark-scenarios-multi.js
     output: json (summary-raw-scenarios-multi.gz)

  scenarios: (100.00%) 2 scenarios, 1100 max VUs, 42s max duration (incl. graceful stop):
           * constant_arrival_rate: 1.00 iterations/s for 3s (maxVUs: 0-1000, gracefulStop: 30s)
           * ramping_vus: Up to 100 looping VUs for 12s over 4 stages (gracefulRampDown: 1m0s, gracefulStop: 30s)

ERRO[0002] Error: only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.
running at i (webpack://k6-jslib-utils/./src/stages.js:92:8(61))
constantat u (webpack://k6-jslib-utils/./src/stages.js:114:26(8))
ramping_at file:///root/tools/k6/benchmark-scenarios-multi.js:148:2(8)
        at native  executor=constant-arrival-rate scenario=constant_arrival_rate source=stacktrace
ERRO[0003] Error: only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.
running at i (webpack://k6-jslib-utils/./src/stages.js:92:8(61))
constantat u (webpack://k6-jslib-utils/./src/stages.js:114:26(8))
ramping_at file:///root/tools/k6/benchmark-scenarios-multi.js:148:2(8)
        at native  executor=constant-arrival-rate scenario=constant_arrival_rate source=stacktrace
^C
running (04.2s), 0000/0101 VUs, 20850 complete and 34 interrupted iterations
constant_arrival_rate ✓ [======================================] 0000/0001 VUs  3s  1.00 iters/s
ramping_vus           ✗ [============>-------------------------] 027/100 VUs    04.2s/12.0s

Hi @eva2000,
I saw you’re using the tagWithCurrentStageIndex function. As the message says this function works only with ramping-vus or ramping-arravial-rate but you have included it in your default function so it will be executed for all the defined scenarios (constant-arrival-rate included).

Let me know which part is not making the error obvious to you so we could try to improve this part.

I see. Didn’t know that. I thought it would tag for only the defined stages. Thanks for the clarification :slight_smile:

2 Likes