Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
Permalink
Browse files

Re-organize libsubmit subdirectories

Note that libsubmit tests were not being run by travis; I'll open an issue to
integrate them separately. For now I've just dumped them in `tests/integration`,
which is ignored by pytest.
  • Loading branch information
annawoodard committed Sep 24, 2018
1 parent e54c01c commit ac71c12bf8c7c830cd8a96e445193ca160dfebe7
Showing with 82 additions and 301 deletions.
  1. +0 −3 .gitmodules
  2. +0 −119 libsubmit/__init__.py
  3. +0 −89 libsubmit/error.py
  4. +0 −2 libsubmit/tests/setup_path.sh
  5. +0 −83 libsubmit/utils.py
  6. +0 −4 libsubmit/version.py
  7. 0 {libsubmit → parsl}/channels/__init__.py
  8. 0 {libsubmit → parsl}/channels/channel_base.py
  9. 0 {libsubmit → parsl}/channels/errors.py
  10. 0 {libsubmit → parsl}/channels/local/__init__.py
  11. 0 {libsubmit → parsl}/channels/local/local.py
  12. 0 {libsubmit → parsl}/channels/ssh/__init__.py
  13. 0 {libsubmit → parsl}/channels/ssh/ssh.py
  14. 0 {libsubmit → parsl}/channels/ssh_il/__init__.py
  15. 0 {libsubmit → parsl}/channels/ssh_il/ssh_il.py
  16. 0 {libsubmit → parsl}/launchers/__init__.py
  17. 0 {libsubmit → parsl}/launchers/launchers.py
  18. +0 −1 parsl/libsubmit
  19. 0 {libsubmit → parsl}/providers/__init__.py
  20. 0 {libsubmit → parsl}/providers/aws/__init__.py
  21. 0 {libsubmit → parsl}/providers/aws/aws.py
  22. 0 {libsubmit → parsl}/providers/aws/template.py
  23. 0 {libsubmit → parsl}/providers/azure/__init__.py
  24. 0 {libsubmit → parsl}/providers/azure/azure.py
  25. 0 {libsubmit → parsl}/providers/azure/azureconf.json
  26. 0 {libsubmit → parsl}/providers/azure/deployer.py
  27. 0 {libsubmit → parsl}/providers/cluster_provider.py
  28. 0 {libsubmit → parsl}/providers/cobalt/__init__.py
  29. 0 {libsubmit → parsl}/providers/cobalt/cobalt.py
  30. 0 {libsubmit → parsl}/providers/cobalt/template.py
  31. 0 {libsubmit → parsl}/providers/condor/__init__.py
  32. 0 {libsubmit → parsl}/providers/condor/condor.py
  33. 0 {libsubmit → parsl}/providers/condor/template.py
  34. 0 {libsubmit → parsl}/providers/googlecloud/__init__.py
  35. 0 {libsubmit → parsl}/providers/googlecloud/googlecloud.py
  36. 0 {libsubmit → parsl}/providers/grid_engine/__init__.py
  37. 0 {libsubmit → parsl}/providers/grid_engine/grid_engine.py
  38. 0 {libsubmit → parsl}/providers/grid_engine/template.py
  39. 0 {libsubmit → parsl}/providers/jetstream/__init__.py
  40. 0 {libsubmit → parsl}/providers/jetstream/jetstream.py
  41. 0 {libsubmit → parsl}/providers/jetstream/setup_first_time.sh
  42. 0 {libsubmit → parsl}/providers/kubernetes/__init__.py
  43. 0 {libsubmit → parsl}/providers/kubernetes/kube.py
  44. 0 {libsubmit → parsl}/providers/kubernetes/template.py
  45. 0 {libsubmit → parsl}/providers/local/__init__.py
  46. 0 {libsubmit → parsl}/providers/local/local.py
  47. 0 {libsubmit → parsl}/providers/provider_base.py
  48. 0 {libsubmit → parsl}/providers/slurm/__init__.py
  49. 0 {libsubmit → parsl}/providers/slurm/slurm.py
  50. 0 {libsubmit → parsl}/providers/slurm/template.py
  51. 0 {libsubmit → parsl}/providers/torque/__init__.py
  52. 0 {libsubmit → parsl}/providers/torque/template.py
  53. 0 {libsubmit → parsl}/providers/torque/torque.py
  54. 0 {libsubmit/tests → parsl/tests/integration}/test_channels/remote_run.sh
  55. 0 {libsubmit/tests → parsl/tests/integration}/test_channels/test_channels.py
  56. 0 {libsubmit/tests → parsl/tests/integration}/test_channels/test_local_channel.py
  57. 0 {libsubmit/tests → parsl/tests/integration}/test_channels/test_scp_1.py
  58. 0 {libsubmit/tests → parsl/tests/integration}/test_channels/test_ssh_1.py
  59. 0 {libsubmit/tests → parsl/tests/integration}/test_channels/test_ssh_errors.py
  60. 0 {libsubmit/tests → parsl/tests/integration}/test_channels/test_ssh_file_transport.py
  61. 0 {libsubmit/tests → parsl/tests/integration}/test_channels/test_ssh_interactive.py
  62. 0 {libsubmit/tests → parsl/tests/integration}/test_integration/test_ssh/test_ssh_beagle.py
  63. 0 {libsubmit/tests → parsl/tests/integration}/test_integration/test_ssh/test_ssh_condor_earth.py
  64. 0 {libsubmit/tests → parsl/tests/integration}/test_integration/test_ssh/test_ssh_cori.py
  65. 0 {libsubmit/tests → parsl/tests/integration}/test_integration/test_ssh/test_ssh_swan.py
  66. 0 {libsubmit/tests → parsl/tests/integration}/test_providers/ec2/test_ec2.py
  67. +82 −0 parsl/utils.py
@@ -1,3 +0,0 @@
[submodule "parsl/libsubmit"]
path = parsl/libsubmit
url = https://github.com/Parsl/libsubmit

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Submodule libsubmit deleted from 63605c
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,3 +1,4 @@
import inspect
import logging
import os
import shlex
@@ -127,3 +128,84 @@ def time_limited_open(path, mode, seconds=1):
f = open(path, mode)
yield f
f.close()

def wtime_to_minutes(time_string):
''' wtime_to_minutes
Convert standard wallclock time string to minutes.
Args:
- Time_string in HH:MM:SS format
Returns:
(int) minutes
'''
hours, mins, seconds = time_string.split(':')
return int(hours) * 60 + int(mins) + 1


class RepresentationMixin(object):
"""A mixin class for adding a __repr__ method.
The __repr__ method will return a string equivalent to the code used to instantiate
the child class, with any defaults included explicitly. The __max_width__ class variable
controls the maximum width of the representation string. If this width is exceeded,
the representation string will be split up, with one argument or keyword argument per line.
Any arguments or keyword arguments in the constructor must be defined as attributes, or
an AttributeError will be raised.
Examples
--------
>>> from libsubmit.utils import RepresentationMixin
>>> class Foo(RepresentationMixin):
def __init__(self, first, second, third='three', fourth='fourth'):
self.first = first
self.second = second
self.third = third
self.fourth = fourth
>>> bar = Foo(1, 'two', fourth='baz')
>>> bar
Foo(1, 'two', third='three', fourth='baz')
"""
__max_width__ = 80

def __repr__(self):
argspec = inspect.getargspec(self.__init__)
if len(argspec.args) > 1:
defaults = dict(zip(reversed(argspec.args), reversed(argspec.defaults)))
else:
defaults = []

for arg in argspec.args[1:]:
if not hasattr(self, arg):
template = 'class {} uses {} in the constructor, but does not define it as an attribute'
raise AttributeError(template.format(self.__class__.__name__, arg))

args = [getattr(self, a) for a in argspec.args[1:-len(defaults)]]
kwargs = {key: getattr(self, key) for key in defaults}

def assemble_multiline(args, kwargs):
def indent(text):
lines = text.splitlines()
if len(lines) <= 1:
return text
return "\n".join(" " + l for l in lines).strip()
args = ["\n {},".format(indent(repr(a))) for a in args]
kwargs = ["\n {}={}".format(k, indent(repr(v)))
for k, v in sorted(kwargs.items())]

info = "".join(args) + ", ".join(kwargs)
return self.__class__.__name__ + "({}\n)".format(info)

def assemble_line(args, kwargs):
kwargs = ['{}={}'.format(k, repr(v)) for k, v in sorted(kwargs.items())]

info = ", ".join([repr(a) for a in args] + kwargs)
return self.__class__.__name__ + "({})".format(info)

if len(assemble_line(args, kwargs)) <= self.__class__.__max_width__:
return assemble_line(args, kwargs)
else:
return assemble_multiline(args, kwargs)

0 comments on commit ac71c12

Please sign in to comment.
You can’t perform that action at this time.