Payu sweep error

Hi! I’ve recently started using the payu in vk83 to run the pananantarctic COSIMA model (I was using the one in hh5), and I’m having the following error when trying to sweep and run one of my experiments:

[jn8053@gadi-login-01 panant-01-zstar-prsc-rest-TESTS]$ payu sweep
laboratory path:  /scratch/x77/jn8053/mom6
binary path:  /scratch/x77/jn8053/mom6/bin
input path:  /scratch/x77/jn8053/mom6/input
work path:  /scratch/x77/jn8053/mom6/work
archive path:  /scratch/x77/jn8053/mom6/archive
/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/payu/metadata.py:134: MetadataWarning: No experiment uuid found in metadata. Generating a new uuid
Traceback (most recent call last):
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/bin/payu", line 10, in <module>
    sys.exit(parse())
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/payu/cli.py", line 49, in parse
    run_cmd(**args)
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/payu/subcommands/sweep_cmd.py", line 17, in runcmd
    expt = Experiment(lab, metadata_off=metadata_off)
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/payu/experiment.py", line 69, in __init__
    self.metadata.setup()
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/payu/metadata.py", line 136, in setup
    self.set_new_uuid(is_new_experiment=is_new_experiment)
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/payu/metadata.py", line 218, in set_new_uuid
    self.set_experiment_name(is_new_experiment=is_new_experiment)
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/payu/metadata.py", line 177, in set_experiment_name
    branch_uuid_experiment_name = self.new_experiment_name()
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/payu/metadata.py", line 143, in new_experiment_name
    self.branch = self.repo.get_branch_name()
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/payu/git_utils.py", line 64, in get_branch_name
    return str(self.repo.active_branch)
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/git/repo/base.py", line 1052, in active_branch
    return self.head.reference
  File "/g/data/vk83/apps/base_conda/envs/payu-1.1.7/lib/python3.10/site-packages/git/refs/symbolic.py", line 413, in _get_reference
    raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha))
TypeError: HEAD is a detached symbolic reference as it points to 'f14970694138b7d63b4720cc9bd4fa3ae31a740f'

If anyone knows how I could fix it I’d appreciate it!

I’m sorry, I don’t know what other information I should include in my post. Please let me know!

It reads to me like you might need to create a working branch for the git repository backing your experiment? git switch -c <new-branch-name> create and switch to a new git branch. The payu experts might have more useful input than me here though!

Hi @JuliaN

@angus-g is right that you don’t have a branch checked out, but I’d like to understand how you got to this point before suggesting a remedy.

Can you tell me the location of your panant-01-zstar-prsc-rest-TESTS control directory?

Do you recall what commands you ran to create it?

Are there any other relevant commands you ran before payu sweep?

Thank you Angus and Aidan!

How I got here:

  1. I cloned an experiment from Adele: /home/157/akm157/mom6/panant-01-zstar-ssp126-MW-only
  2. I used the old payu at hh5 to run several tests.
  3. Decided today to try the new payu and got that error. So I’ve switched back to hh5 cause I needed the tests to run!

I know this is all messy and not best practice, I haven’t had the time to go over the awesome new docs NRI has put together but I promise I will soon!

The experiment is at: /home/561/jn8053/payu/mom6/panant-01-zstar-prsc-rest-TESTS

Thanks for sharing that information, it is very helpful.

Unfortunately I can’t access your control directory at all, and the .git directory in Adele’s control directory is not readable by me.

It would be good to work out what went wrong so we can make sure the instructions cover this use case.

If either you or Adele could clone your control directory to a directory you own under /scratch/ol01/, or /scratch/public that would be helpful.

I have created an issue to modify payu to print a more helpful message in a case such as this

https://github.com/payu-org/payu/issues/625

It is important to move to using payu from xp65 as soon as possible, as the hh5 environments will be removed in just over a month.

Thanks Aidan! I’ve cloned those repositories in /scratch/ol01/jn8053/payu_for_aidan. Hopefully you’ll be able to access them!

Creating a new branched fixed it. Silly me. Thank you Angus!

Thanks @JuliaN.

When I tried to clone Adele’s repo I got this message:

$ git clone --no-hardlinks /scratch/ol01/jn8053/payu_for_aidan/panant-01-zstar-ssp126-MW-only
Cloning into 'panant-01-zstar-ssp126-MW-only'...
done.
Note: switching to 'bbb7a5986bafda1121e793ae6a108a302f8fa4cb'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

So the original repo also didn’t have a checked out branch. If you, or anyone else, sees that message it is best to checkout a branch before doing anything else, e.g.

git checkout -b <branchname>

payu should also give a friendlier answer when this error occurs, with advice similar to above. I’ll try and make a PR to fix it, although anyone else is free to do so and ping me for a review.

Glad @angus-g was able to solve your issue. I’ll close this topic, but do create a new one if you have any other questions.

1 Like