# Error when finalising a \`renku run python\` command

**URL:** <https://renku.discourse.group/t/error-when-finalising-a-renku-run-python-command/312>\
**Category:** General\
**Created:** [9 April 2021 19:29 UTC](https://renku.discourse.group/t/error-when-finalising-a-renku-run-python-command/312 "2021-04-09T19:29:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lusamino](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/lusamino/32/227_2.png) [@lusamino](https://renku.discourse.group/u/lusamino)\
**Post date:** [9 April 2021 19:29 UTC](https://renku.discourse.group/t/error-when-finalising-a-renku-run-python-command/312/1 "2021-04-09T19:29:31Z")

</div>

Hi to all,

I don’t know why this is happening now, as the code was running perfectly, and `renku run` was creating beautiful KGs. But, since yesterday, this started happening: when the python scripts finishes, the following error message appears, which make the script fail (I have a loop in a bash script), and leave the process of storing all `renku` stuff uncompleted. Here the complete error message:

```
Total time for correction of year 1950: 6027.739594    
Traceback (most recent call last):
      File "/home/luis/.local/bin/renku", line 8, in <module>
        sys.exit(cli())
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/click/core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/renku/cli/exception_handler.py", line 122, in main
        result = super().main(*args, **kwargs)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/renku/cli/exception_handler.py", line 88, in main
        return super().main(*args, **kwargs)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/click/core.py", line 782, in main
        rv = self.invoke(ctx)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/click/core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/renku/cli/run.py", line 252, in run
        command_line=command_line,
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/renku/core/incubation/command.py", line 131, in execute
        output = context["click_context"].invoke(self._operation, context["client"], *args, **kwargs)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/click/core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/renku/core/commands/run.py", line 141, in _run_command
        client.process_and_store_run(command_line_tool=tool, name=name, client=client)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/renku/core/management/repository.py", line 497, in process_and_store_run
        self.add_to_activity_index(process_run)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/renku/core/management/repository.py", line 582, in add_to_activity_index
        if g.path not in self.path_activity_cache:
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/renku/core/management/repository.py", line 573, in path_activity_cache
        self._activity_index = yaml.safe_load(stream)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/ __init__.py", line 162, in safe_load
        return load(stream, SafeLoader)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/ __init__.py", line 114, in load
        return loader.get_single_data()
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/constructor.py", line 49, in get_single_data
        node = self.get_single_node()
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/composer.py", line 36, in get_single_node
        document = self.compose_document()
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/composer.py", line 55, in compose_document
        node = self.compose_node(None, None)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/composer.py", line 84, in compose_node
        node = self.compose_mapping_node(anchor)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/composer.py", line 133, in compose_mapping_node
        item_value = self.compose_node(node, item_key)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/composer.py", line 84, in compose_node
        node = self.compose_mapping_node(anchor)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/composer.py", line 133, in compose_mapping_node
        item_value = self.compose_node(node, item_key)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/composer.py", line 82, in compose_node
        node = self.compose_sequence_node(anchor)
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/composer.py", line 110, in compose_sequence_node
        while not self.check_event(SequenceEndEvent):
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/parser.py", line 98, in check_event
        self.current_event = self.state()
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/parser.py", line 403, in parse_indentless_sequence_entry
        if self.check_token(BlockEntryToken):
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/scanner.py", line 115, in check_token
        while self.need_more_tokens():
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/scanner.py", line 152, in need_more_tokens
        self.stale_possible_simple_keys()
      File "/home/luis/.local/pipx/venvs/renku/lib/python3.6/site-packages/yaml/scanner.py", line 292, in stale_possible_simple_keys
        "could not find expected ':'", self.get_mark())
    yaml.scanner.ScannerError: while scanning a simple key
      in "/home/luis/Democrasci/demo_run2/democrasci-fullpreproc/.renku/activity_index.yaml", line 58, column 1
    could not find expected ':'
      in "/home/luis/Democrasci/demo_run2/democrasci-fullpreproc/.renku/activity_index.yaml", line 59, column 1
    Error: The repository is dirty. Please use the "git" command to clean it.

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified: .gitattributes

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .renku/workflow/de9e7585afbd407a8417fb0cb57382fe_python.yaml

no changes added to commit (use "git add" and/or "git commit -a")

Once you have added the untracked files, commit them with "git commit".

```

I am sorry, but I have 0 idea what might be happening. I can only confirm my code finishes correctly, as the line `Total time for correction of year 1950: 6027.739594` is the last one of the python script executed.

Thanks for all your help!  
Cheers  
Luis

---

<div class="post-metadata">

**Author:** ![lusamino](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/lusamino/32/227_2.png) [@lusamino](https://renku.discourse.group/u/lusamino)\
**Post date:** [15 April 2021 06:55 UTC](https://renku.discourse.group/t/error-when-finalising-a-renku-run-python-command/312/2 "2021-04-15T06:55:51Z")

</div>

Hi folks,

Any ideas about this error? I had to stop using `renku run` as it was interrupting my simulations and, in any case, it was not creating the KGs. I would try in any case at some point with other piece of code, and assess where might be the reason, though as said before, my code finished running (the printed message).

Also, could I solve something if I update/reinstall `renku`?

Thanks!  
Cheers  
Luis

---

<div class="post-metadata">

**Author:** ![ralf.grubenmann](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/ralf.grubenmann/32/78_2.png) [@ralf.grubenmann](https://renku.discourse.group/u/ralf.grubenmann)\
**Post date:** [15 April 2021 07:13 UTC](https://renku.discourse.group/t/error-when-finalising-a-renku-run-python-command/312/3 "2021-04-15T07:13:29Z")

</div>

Is it this project [Renku](https://renkulab.io/projects/luis.salamanca/democrasci-fullpreproc/) ?

If so, you have an unresolved merge conflict in `.renku/activity_index.yaml` (look for the `<<<<<<< HEAD` part).

Did you run a workflow on one branch, and then another workflow on another branch, and then merge the branches? We unfortunately don’t support merging branches with parallel workflows (yet).

If you want to merge it manually, you’d have to combine the entries, e.g.

```auto
>>> HEAD
some_path:
  abcdefg:
    - .renku/workflow/12312414_python.yaml
======
some_path:
  987654:
    - .renku/workflow/53535335_python.yaml
<<<<HEAD

```

would be

```auto
some_path:
  abcdefg:
    - .renku/workflow/12312414_python.yaml
  987654:
    - .renku/workflow/53535335_python.yaml

```

or

```auto
>>> HEAD
some_path:
  abcdefg:
    - .renku/workflow/12312414_python.yaml
======
some_path:
  abcdefg:
    - .renku/workflow/53535335_python.yaml
<<<<HEAD

```

would be

```auto
some_path:
  abcdefg:
    - .renku/workflow/12312414_python.yaml
    - .renku/workflow/53535335_python.yaml

```

i.e. you can concatenate the entries.  
Though in the second case (where you end up with `some_path` at commit `abcdefg` being created by two workflows (12312414\_python and 53535335\_python) that’d probably break things further down the line, as you can’t have a file in a single commit being created by two workflows at the same time.  
Also, if this was a rebase that changed commits, this wouldn’t work either as now the file refers to commits that don’t exist anymore.

---

<div class="post-metadata">

**Author:** ![lusamino](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/lusamino/32/227_2.png) [@lusamino](https://renku.discourse.group/u/lusamino)\
**Post date:** [19 April 2021 06:49 UTC](https://renku.discourse.group/t/error-when-finalising-a-renku-run-python-command/312/4 "2021-04-19T06:49:33Z")

</div>

HI @ralf.grubenmann !

Thanks for your answer! Wow, that makes total sense, but now I wondered how that happened… I believe in principle `renku run` could only be run with a clean repo, that means, after pushing and pulling everything, and therefore, after solving any possible merging conflict. Therefore, I was not expecting this to happen.

And nope, I am running on different branches. What I have done is to clone the repo in 2 different folders, and I am running them in parallel. Obviously, they don’t collide in the files they use/create, and I used this approach already a few days before and it worker, without any problem. But now, well, I know where the problem was, and I will try to run some of those tasks again having checked the `.renku/activity_index.yaml` before.

Thanks for the finding @ralf.grubenmann !! It has been super useful your answer, and I believe this will solve any future problem!

Cheers  
Luis
