NOAA-GSL / ExascaleWorkflowSandbox

Other
2 stars 2 forks source link

Update tests to test_run_mpi_pi verifies the tasks run concurrently #57

Closed NaureenBharwaniNOAA closed 7 months ago

NaureenBharwaniNOAA commented 8 months ago

The test_run_mpi_pi test in test_parsl_flux_mpi_hello.py ensures that two runs of the mpi_pi.exe program do not share nodes. The expansion of the tests verifies that the tests run concurrently.

Confirming in parsl_flux_mpi_pi1_run.out and parsl_flux_mpi_pi2_run.out, the output has a time stamp that has been updated for the start and end times of the run from a HH:MM:SS format to a YYYY:MM:DD:HH:MM:SS format. The Fortran code has been updated to reflect these changes. This update was needed to prove that the two tests run concurrently, including two additional assertions.

Note: We needed to guarantee that the start time of pi1 is not greater than the end time of pi2 and that the start time of pi2 is not greater than the end time of pi1.

Currently:

Still needs to be done:

Closes #46.

NaureenBharwaniNOAA commented 8 months ago

Used this source to update the Fortran time stamp as needed: https://faculty.cs.niu.edu/~hutchins/csci297p2/webpages/datetime.htm#:~:text=Suppose%20a%20FORTRAN%20program%20needs,Values%2C%20all%20used%20for%20output.

NaureenBharwaniNOAA commented 8 months ago

I've been failing the tests with this message Error: Error: No public SSH keys registered with NaureenBharwaniNOAA's GitHub profile. I can try adding an SSH key to my profile, not sure if I have that set-up, but I definitely have a personal access token set-up and usually clone the HTTPS version on a GitHub repo.

I was also initially failing 2 of test cases that are being addressed from the GitHub issue, but on my side I pass all 8 tests fine.

christopherwharrop-noaa commented 8 months ago

@NaureenBharwaniNOAA - The ssh key message isn't the failure. It's having a problem with the run hello and the mpi_pi tests. Not sure what the issue is. I assume tests pass locally?

NaureenBharwaniNOAA commented 7 months ago

@NaureenBharwaniNOAA - The ssh key message isn't the failure. It's having a problem with the run hello and the mpi_pi tests. Not sure what the issue is. I assume tests pass locally?

Yes, the tests do pass locally for me just fine. I was going to begin worked on the additional assert statements for the second half of this ticket. Do you think that it should be fine? Or should I hold off?

christopherwharrop-noaa commented 7 months ago

Keep working on it. I'll clone your branch and see if I can figure out what is going on.

christopherwharrop-noaa commented 7 months ago

Ok... How about this:

start_time=[]
end_time=[]
for i in (1,2):
    with open('''parsl_flux_mpi_pi{}_run.out'''.format(i), "r") as pi: 
        for line in pi:
            if re.match(r"Start Time ", line):
                line = line.strip().lstrip("Start Time = ")
                start_time.append(dt.strptime(line, "%d/%m/%Y %H:%M:%S"))
            if re.match(r"End Time ", line):
                line = line.strip().lstrip("End Time = ")
                end_time.append(dt.strptime(line, "%d/%m/%Y %H:%M:%S"))
assert start_time[0] < end_time[1] and start_time[1] < end_time[0]
christopherwharrop-noaa commented 7 months ago

You could probably DRY it out even more....

times={}
for i in (1,2):
    with open('''parsl_flux_mpi_pi{}_run.out'''.format(i), "r") as pi: 
        for line in pi:
            for tstr in ("Start Time", "End Time"):
                times[tstr]=[]
                if re.match(r'''{} '''.format(tstr), line):
                    line = line.strip().lstrip('''{} = '''.format(tstr))
                    times[tstr].append(dt.strptime(line, "%d/%m/%Y %H:%M:%S"))
assert times["Start Time"][0] < times["End Time"][1] and times["Start Time"][1] < times["End Time"][0]
christopherwharrop-noaa commented 7 months ago

@NaureenBharwaniNOAA - Please go ahead and merge this when you have a moment.

christopherwharrop-noaa commented 7 months ago

BTW - Your solution for DRYing the code was much better than mine!