goerz / gc3pie

Automatically exported from code.google.com/p/gc3pie
0 stars 0 forks source link

`gselect` not selecting jobs in `NEW` state #472

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run `gdemo_session.py` without `-C` option
2. check that the job is in `NEW` state
3. run `gselect -s gdemo_session -l NEW`

What is the expected output? What do you see instead?

The `gselect` command should print the id of the `DemoIteration` job. Instead, 
nothing is printed.

The root cause is in method `cmd_gselect.filter_by_submission_date`, in 
`gc3utils.commands`:

        matching_jobs = []
        for job in job_list:
            submission_time = job.execution.timestamp.get(Run.State.SUBMITTED, None)
            if submission_time is None:
                # Jobs run by the ShellCmd backend transition directly to
                # RUNNING; use that timestamp if available.
                submission_time = job.execution.timestamp.get(Run.State.RUNNING, None)

            if (submission_time is not None
                and submission_time <= end
                and submission_time >= start):
                matching_jobs.append(job)
        return matching_jobs

When a job is still in `NEW` state, `submission_time` is always
`None`, but the code above does not check for this case and *never*
select the job.

This also depends on the fact that `gselect` *always* filters by
submission date (although by default it is set to 0.0).

The current behaviour makes sense considering that `gselect` is mainly
used as a filter for the `gresub` command, but I think that for
consistency reasons should also allow selecting jobs in `NEW` state.

Original issue reported on code.google.com by arcimbo...@gmail.com on 2 Dec 2014 at 7:05

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r4089.

Original comment by antonio....@gmail.com on 2 Dec 2014 at 11:25