Skip to content

Commit

Permalink
Merge pull request #24 from boegel/gc3pie
Browse files Browse the repository at this point in the history
style fixes in job/backend.py and parallelbuild.py
  • Loading branch information
riccardomurri committed Jul 8, 2015
2 parents f655ec2 + 1f487a1 commit 904d5b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
6 changes: 5 additions & 1 deletion easybuild/tools/job/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
"""Abstract interface for submitting jobs and related utilities."""
"""
Abstract interface for submitting jobs and related utilities.
@author: Riccardo Murri (University of Zurich)
@author: Kenneth Hoste (Ghent University)
"""

from abc import ABCMeta, abstractmethod

Expand Down
19 changes: 9 additions & 10 deletions easybuild/tools/parallelbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def build_easyconfigs_in_parallel(build_command, easyconfigs, output_dir='easybu
"""
_log.info("going to build these easyconfigs in parallel: %s", easyconfigs)

live_job_backend = job_backend()
if live_job_backend is None:
active_job_backend = job_backend()
if active_job_backend is None:
raise EasyBuildError("Can not use --job if no job backend is available.")

try:
live_job_backend.init()
active_job_backend.init()
except RuntimeError as err:
raise EasyBuildError("connection to server failed (%s: %s), can't submit jobs.", err.__class__.__name__, err)

Expand All @@ -94,22 +94,21 @@ def build_easyconfigs_in_parallel(build_command, easyconfigs, output_dir='easybu

# the new job will only depend on already submitted jobs
_log.info("creating job for ec: %s" % str(ec))
new_job = create_job(live_job_backend, build_command, ec, output_dir=output_dir)
new_job = create_job(active_job_backend, build_command, ec, output_dir=output_dir)

# sometimes unresolved_deps will contain things, not needed to be build
job_deps = [module_to_job[dep] for dep in map(_to_key, ec['unresolved_deps']) if dep in module_to_job]
dep_mod_names = map(ActiveMNS().det_full_module_name, ec['unresolved_deps'])
job_deps = [module_to_job[dep] for dep in dep_mod_names if dep in module_to_job]

# actually (try to) submit job
live_job_backend.queue(new_job, job_deps)
_log.info(
"job %s for module %s has been submitted"
% (new_job, new_job.module))
active_job_backend.queue(new_job, job_deps)
_log.info("job %s for module %s has been submitted", new_job, new_job.module)

# update dictionary
module_to_job[new_job.module] = new_job
jobs.append(new_job)

live_job_backend.complete()
active_job_backend.complete()

return jobs

Expand Down

0 comments on commit 904d5b3

Please sign in to comment.