Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPLIT_LAST parameter commented out in the code #2099

Open
ainagaya opened this issue Feb 4, 2025 · 8 comments
Open

SPLIT_LAST parameter commented out in the code #2099

ainagaya opened this issue Feb 4, 2025 · 8 comments
Milestone

Comments

@ainagaya
Copy link
Contributor

ainagaya commented Feb 4, 2025

Hi @kinow @dbeltrankyl ,

I was checking the available variables with calendar information about the splits. I wanted a variable that tells me if that SPLIT is the last split of the chunk or not. For that, what I tried was SPLIT_LAST (even though I thought that maybe it meant the last split of the whole simulation, meaning the last SPLIT of the last CHUNK), but I saw that the block of code defining that variable is commented out: https://github.com/search?q=repo%3ABSC-ES%2Fautosubmit+SPLIT_LAST&type=code

I think that is a nice parameter that could be (re)included.

Thanks!

@dbeltrankyl
Copy link
Contributor

Uh, not sure why it is commented.

You can do this meanwhile:

[ %SPLIT% -eq %SPLITSIZE% ] (%SPLIT% starts in 1 )

@dbeltrankyl dbeltrankyl added this to the 4.1.13 milestone Feb 4, 2025
@ainagaya
Copy link
Contributor Author

ainagaya commented Feb 4, 2025

Hi @dbeltrankyl , thanks! But this gives the equivalent to SPLIT_FIRST, doesn't it? I think that I will compare SPLIT_END_DATE with CHUNK_END_DATE, and that should work.

@dbeltrankyl
Copy link
Contributor

I think, it is the last, no?

Having a job_date_member_chunk configured like this

job_date_member_chunk_1
..
job_date_member_chunk_31
%JOBS.JOB.SPLITS%: 31 ( or auto) 

template:

%SPLITS% == 31 ( or auto ) # This is what you define, it returns the value as it was set 
%SPLITSIZE% == 31  # this the actual definitive  size

%SPLIT% == 1 for job_date_member_chunk_1

%SPLIT% == 31 for job_date_member_chunk_31

[ 1 -eq 31 ] # job_date_member_chunk_1
 don't enter

[ 31 -eq 31 ] # job_date_member_chunk_31
 enter

@ainagaya
Copy link
Contributor Author

ainagaya commented Feb 4, 2025

In my case I have this values for the latest split:

SPLIT=${27:-31}
SPLITSIZE=${28:-1}

That comes from:

JOBS:
  TRANSFER:
    FILE: templates/transfer.sh
    PLATFORM: lumi-transfer
    DEPENDENCIES: SIM TRANSFER-1
    RUNNING: chunk
    SPLITS: 'auto'
EXPERIMENT:
  SPLITSIZEUNIT: day # default CHUNKSIZEUNIT-1 (month-1 == day)
  # Split size. NUMERIC: 4, 6, 12
  SPLITSIZE: 2
  # Split policy. STRING: flexible, strict
  SPLITPOLICY: flexible

So I think that since I'm using auto the splitsize varies among splits.

What I want to know is if the current split is the latest in that chunk or not.

@ainagaya
Copy link
Contributor Author

ainagaya commented Feb 4, 2025

Maybe comparing with SPLIT with CHUNKSIZE is what makes sense?

@dbeltrankyl
Copy link
Contributor

dbeltrankyl commented Feb 4, 2025

I've tested it and %SPLITS% -eq %SPLIT% should be enough

  a:
    SCRIPT: |
      echo "Hello World with id=FAILED + wrappers"
      echo "SPLITS: %SPLITS%"
      echo "SPLIT: %SPLIT%"
      echo "SPLITSIZE: %SPLITSIZE%"
    PLATFORM: MARENOSTRUM5
    DEPENDENCIES: a-1
    RUNNING: chunk
    wallclock: 00:02
    threads: 4
    EXCLUSIVE: True
    splits: auto

What I want to know is if the current split is the latest in that chunk or not.

chunk 1

cat a000_20221101_fc1_1_61_A.cmd

echo "SPLITS: 61"
echo "SPLIT: 61"

[ 61 -eq 61 ] is true, and it is the last split of the current chunk

cat a000_20221101_fc1_1_1_A.cmd

echo "SPLITS: 61"
echo "SPLIT: 1"

chunk 2:

cat a000_20221101_fc1_2_59_A.cmd* of the current chunk

echo "SPLITS: 59"
echo "SPLIT: 59"

[ 59 -eq 59 ] is true, and it is the last split of the current chunk

cat a000_20221101_fc1_2_1_A.cmd

echo "SPLITS: 59"
echo "SPLIT: 1"

While for the first is False ( and the rest )

So I think that since I'm using auto the splitsize varies among splits.

It shouldn't vary until you go to the next chunk, I think %SPLITS% is more reliable after the testing.

@ainagaya
Copy link
Contributor Author

ainagaya commented Feb 4, 2025

Nice, thanks Dani!! So SPLITS is the total number of splits in a chunk, right? Linking #1463 , because it is documented, but I did not understand the variable meaning.

It shouldn't vary until you go to the next chunk, I think %SPLITS% is more reliable after the testing.

But for example if the splitsize is 2 and the policy is flexible, for January I get 15 splits of 2 days and 1 split of 1 day, right?

Sorry for all these questions!! Trying to find the best way to handle https://earth.bsc.es/gitlab/digital-twins/de_340-2/workflow/-/issues/827 :)

@dbeltrankyl
Copy link
Contributor

Nice, thanks Dani!! So SPLITS is the total number of splits in a chunk, right?

Yes,

But for example if the splitsize is 2 and the policy is flexible, for January I get 15 splits of 2 days and 1 split of 1 day, right?

if I recall well, what happens is that you will get 15 splits but the last split will contain 3 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants