Skip to content

Commit

Permalink
Use pattern matching
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Dec 19, 2024
1 parent 064ee28 commit 865dee5
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/ert/scheduler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@


def create_driver(queue_options: QueueOptions) -> Driver:
if queue_options.name == QueueSystem.LOCAL:
return LocalDriver()
elif queue_options.name == QueueSystem.TORQUE:
return OpenPBSDriver(**queue_options.driver_options)
elif queue_options.name == QueueSystem.LSF:
return LsfDriver(**queue_options.driver_options)
elif queue_options.name == QueueSystem.SLURM:
return SlurmDriver(
**dict(
{"user": getpwuid(getuid()).pw_name},
**queue_options.driver_options,
match str(queue_options.name).upper():
case QueueSystem.LOCAL:
return LocalDriver()
case QueueSystem.TORQUE:
return OpenPBSDriver(**queue_options.driver_options)
case QueueSystem.LSF:
return LsfDriver(**queue_options.driver_options)
case QueueSystem.SLURM:
return SlurmDriver(
**dict(
{"user": getpwuid(getuid()).pw_name},
**queue_options.driver_options,
)
)
)
else:
raise NotImplementedError(
"Only LOCAL, SLURM, TORQUE and LSF drivers are implemented"
)
raise NotImplementedError(
"Only LOCAL, SLURM, TORQUE and LSF drivers are implemented"
)


__all__ = [
Expand Down

0 comments on commit 865dee5

Please sign in to comment.