Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

error with case.submit

djk2120

Daniel Kennedy
New Member
Apologies if this duplicates any other postings here... but I've been occasionally experiencing an error that I can't figure out when trying to submit land-only simulations.
Calling ./case.submit will throw:

Code:
Loading input file list: 'Buildconf/clm.input_data_list'
Traceback (most recent call last):
  File "./case.submit", line 126, in <module>
    _main_func(__doc__)
  File "./case.submit", line 123, in _main_func
    mail_user=mail_user, mail_type=mail_type, batch_args=batch_args, workflow=workflow)
  File "/glade/work/djk2120/ctsm_hardcode_co/cime/scripts/Tools/../../scripts/lib/CIME/case/case_submit.py", line 205, in submit
    custom_success_msg_functor=verbatim_success_msg)
  File "/glade/work/djk2120/ctsm_hardcode_co/cime/scripts/Tools/../../scripts/lib/CIME/utils.py", line 1739, in run_and_log_case_status
    rv = func()
  File "/glade/work/djk2120/ctsm_hardcode_co/cime/scripts/Tools/../../scripts/lib/CIME/case/case_submit.py", line 203, in <lambda>
    batch_args=batch_args, workflow=workflow)
  File "/glade/work/djk2120/ctsm_hardcode_co/cime/scripts/Tools/../../scripts/lib/CIME/case/case_submit.py", line 133, in _submit
    case.check_case()
  File "/glade/work/djk2120/ctsm_hardcode_co/cime/scripts/Tools/../../scripts/lib/CIME/case/case_submit.py", line 219, in check_case
    self.check_all_input_data()
  File "/glade/work/djk2120/ctsm_hardcode_co/cime/scripts/Tools/../../scripts/lib/CIME/case/check_input_data.py", line 166, in check_all_input_data
    input_data_root=input_data_root, data_list_dir=data_list_dir, chksum=chksum and chksum_found)
  File "/glade/work/djk2120/ctsm_hardcode_co/cime/scripts/Tools/../../scripts/lib/CIME/case/check_input_data.py", line 335, in check_input_data
    if ("/" in rel_path and rel_path == full_path and not full_path.startswith('unknown')):
UnboundLocalError: local variable 'rel_path' referenced before assignment

Though I'm sure to be wrong, but the error seems to occur at random... Running my own script that eventually calls case.submit for three cases, it often times might be only one of the three cases will throw this error (with no discernible pattern). I am using the multi-instance functionality and running the simulations from a restart file.

If after my script runs I go back to the casedir for any failing cases and run ./case.submit again, it typically will work without throwing the error. So I would say this is not particularly urgent, because I have a workaround, but ideally I would like to be able to get the cases to submit on the first go.

Thanks,
Daniel
 

jedwards

CSEG and Liaisons
Staff member
You didn't tell us which version of the code you are using. Please run ./manage_externals/checkout_externals -Sv and provide the version of cime.
 

djk2120

Daniel Kennedy
New Member
Sorry, here it is:
Code:
[u@cheyenne1: ctsm_hardcode_co]$ ./manage_externals/checkout_externals -Sv
Processing externals description file : Externals.cfg
Processing externals description file : Externals_CISM.cfg
Processing externals description file : Externals_CLM.cfg
Processing externals description file : ../Externals_cime.cfg
Checking status of externals: cism, source_cism, clm, fates, ptclm, mosart, cime, cmeps, rtm,
    ./cime
        clean sandbox, on cime5.8.17
    ./cime/src/drivers/nuopc/
        clean sandbox, on 253f612acae07b2b1dc73c84f1bb30b8e1b86ddd
    ./components/cism
        clean sandbox, on cism2_1_68
    ./components/cism/source_cism
        clean sandbox, on 9f57475aadf2d807b97b9c20f53e6ddc6daf0dfb
    ./components/mosart
        clean sandbox, on mosart1_0_36
    ./components/rtm
        clean sandbox, on rtm1_0_71
    ./src/fates
        clean sandbox, on fates_s1.8.1_a3.0.0_rev2
    ./tools/PTCLM
        clean sandbox, on PTCLM2_180611
 

berkninan

berkninan
New Member
UnboundLocalError: local variable 'rel_path' referenced before assignment

The Unboundlocalerror: local variable referenced before assignment is raised when you try to use a variable before it has been assigned in the local context. Python doesn't have variable declarations , so it has to figure out the scope of variables itself. It does so by a simple rule: If there is an assignment to a variable inside a function, that variable is considered local . To solve this problem, you can explicitly say it's a global by putting global declaration in your function. The global statement does not have to be at the beginning of the function definition, but that is where it is usually placed. Wherever it is placed, the global declaration makes a variable to global variable everywhere in the function.
 
Top