# How to define "target-throughput" in cmd line of custom track

**URL:** <https://discuss.elastic.co/t/how-to-define-target-throughput-in-cmd-line-of-custom-track/326831>\
**Category:** Elasticsearch\
**Tags:** rally\
**Created:** [March 2, 2023, 9:16am UTC](https://discuss.elastic.co/t/how-to-define-target-throughput-in-cmd-line-of-custom-track/326831 "2023-03-02T09:16:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dan\_kim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dan_kim/32/95741_2.png) [@dan\_kim](https://discuss.elastic.co/u/dan_kim)\
**Post date:** [March 2, 2023, 9:16am UTC](https://discuss.elastic.co/t/how-to-define-target-throughput-in-cmd-line-of-custom-track/326831/1 "2023-03-02T09:16:58Z")

</div>

hello i'm trying to make new custom track and just found how to write basic custom track

and i have question that how can i pass params from command line

for example, i want to set target-throuput on command line like  
"esrally race --pipeline=benchmark-only --track-path=~/myCustomTrack/searchOps --target-throuput=1000"

im currently made track.py which build params for match\_all query.  
And if there is some problem with my code let me know please .

```auto
def query_single_word(track, params, **kwargs):
    # choose a suitable index: if there is only one defined for this track
    # choose that one, but let the user always override index and type.
    init_word()
    target_throughput = params.get("target-throughput", 1000)
    if len(track.indices) == 1:
        default_index = track.indices[0].name
        if len(track.indices[0].types) == 1:
            default_type = track.indices[0].types[0].name
        else:
            default_type = None
    else:
        default_index = "text-index"
        default_type = None

    index_name = params.get("index", default_index)
    type_name = params.get("type", default_type)

    # you must provide all parameters that the runner expects
    return {
        "body": {
            "query": {
                "term": {
                    "body": "%s" % buildParamWithLength(4)
                }
            }
        },
        "index": index_name,
        "type": type_name,
        "cache": params.get("cache", False)
        
    }
        
def buildParamWithLength(leng):
    if wordList == []:
        raise Exception("param is null")
    param = ""
   
    for _ in range(leng):
        param += (random.choice(wordList) + " ")
    return param
     
def register(registry):
    registry.register_param_source("query_single_word-body", query_single_word)

```

---

<div class="post-metadata">

**Author:** ![Quentin\_Pradet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/quentin_pradet/32/94192_2.png) [@Quentin\_Pradet](https://discuss.elastic.co/u/Quentin_Pradet)\
**Post date:** [March 2, 2023, 10:29am UTC](https://discuss.elastic.co/t/how-to-define-target-throughput-in-cmd-line-of-custom-track/326831/2 "2023-03-02T10:29:25Z")

</div>

Hello @dan_kim. Please use the `--track-params` command line parameter documented in [Command Line Reference - Rally 2.7.0 documentation](https://esrally.readthedocs.io/en/stable/command_line_reference.html#track-params). Your example would look like this:

```auto
esrally race --pipeline=benchmark-only --track-path=~/myCustomTrack/searchOps --track-params=target-throughput:1000

```

---

<div class="post-metadata">

**Author:** ![dan\_kim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dan_kim/32/95741_2.png) [@dan\_kim](https://discuss.elastic.co/u/dan_kim)\
**Post date:** [March 5, 2023, 6:29am UTC](https://discuss.elastic.co/t/how-to-define-target-throughput-in-cmd-line-of-custom-track/326831/3 "2023-03-05T06:29:54Z")

</div>

Thank you ! for your simple and complete answer

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 2, 2023, 6:30am UTC](https://discuss.elastic.co/t/how-to-define-target-throughput-in-cmd-line-of-custom-track/326831/4 "2023-04-02T06:30:54Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
