Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hostname to Docker Swarm service ID #369

Closed
wants to merge 4 commits into from

Conversation

kislyuk
Copy link
Contributor

@kislyuk kislyuk commented Apr 10, 2020

Motivation

See #368

Approach

Truncate hostname to the first 12 characters (length of Docker container ID as it appears in the hostname)

Checklist

  • Add appropriate test(s) to the automatic suite
  • Use make pretty to reformat the code with black
  • Use make check to statically check the code using Pyre and Pylint
  • Send PR from a dedicated branch without unrelated edits
  • Ensure compatibility with this project's MIT license

@kislyuk
Copy link
Contributor Author

kislyuk commented Apr 10, 2020

Not entirely sure what I'm doing wrong but I can't run make check locally:

akislyuk@demeter:~/projects/miniwdl>make check
pyre \
		--search-path stubs \
		--typeshed `python3 -c 'import site; print(site.getuserbase())'`/lib/pyre_check/typeshed \
		--show-parse-errors check
Traceback (most recent call last):
  File "/usr/local/bin/pyre", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/pyre_check/pyre.py", line 392, in main
    arguments = parser.parse_args()
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py", line 1755, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py", line 1787, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py", line 1993, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py", line 1933, in consume_optional
    take_action(action, args, option_string)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py", line 1845, in take_action
    argument_values = self._get_values(action, argument_strings)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py", line 2376, in _get_values
    value = self._get_value(action, arg_string)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py", line 2409, in _get_value
    result = type_func(arg_string)
  File "/usr/local/lib/python3.7/site-packages/pyre_check/__init__.py", line 50, in readable_directory
    assert_readable_directory(directory)
  File "/usr/local/lib/python3.7/site-packages/pyre_check/__init__.py", line 37, in assert_readable_directory
    raise EnvironmentException("{} is not a valid directory.".format(directory))
pyre_check.exceptions.EnvironmentException: /Users/akislyuk/Library/Python/3.7/lib/pyre_check/typeshed is not a valid directory.
make: *** [check] Error 1

@kislyuk
Copy link
Contributor Author

kislyuk commented Apr 10, 2020

This is a bit inconvenient:

2020-04-10 02:16:27+00:00 Collecting https://github.com/chanzuckerberg/miniwdl/archive/akislyuk-hostname-docker-swarm-service-id.tar.gz
2020-04-10 02:16:28+00:00   Downloading https://github.com/chanzuckerberg/miniwdl/archive/akislyuk-hostname-docker-swarm-service-id.tar.gz
2020-04-10 02:16:29+00:00     Complete output from command python setup.py egg_info:
2020-04-10 02:16:29+00:00     ERROR:root:Error parsing
2020-04-10 02:16:29+00:00     Traceback (most recent call last):
2020-04-10 02:16:29+00:00       File "/tmp/pip-l3lg3stq-build/.eggs/pbr-5.4.5-py3.6.egg/pbr/core.py", line 96, in pbr
2020-04-10 02:16:29+00:00         attrs = util.cfg_to_args(path, dist.script_args)
2020-04-10 02:16:29+00:00       File "/tmp/pip-l3lg3stq-build/.eggs/pbr-5.4.5-py3.6.egg/pbr/util.py", line 271, in cfg_to_args
2020-04-10 02:16:29+00:00         pbr.hooks.setup_hook(config)
2020-04-10 02:16:29+00:00       File "/tmp/pip-l3lg3stq-build/.eggs/pbr-5.4.5-py3.6.egg/pbr/hooks/__init__.py", line 25, in setup_hook
2020-04-10 02:16:29+00:00         metadata_config.run()
2020-04-10 02:16:29+00:00       File "/tmp/pip-l3lg3stq-build/.eggs/pbr-5.4.5-py3.6.egg/pbr/hooks/base.py", line 27, in run
2020-04-10 02:16:29+00:00         self.hook()
2020-04-10 02:16:29+00:00       File "/tmp/pip-l3lg3stq-build/.eggs/pbr-5.4.5-py3.6.egg/pbr/hooks/metadata.py", line 26, in hook
2020-04-10 02:16:29+00:00         self.config['name'], self.config.get('version', None))
2020-04-10 02:16:29+00:00       File "/tmp/pip-l3lg3stq-build/.eggs/pbr-5.4.5-py3.6.egg/pbr/packaging.py", line 876, in get_version
2020-04-10 02:16:29+00:00         name=package_name))
2020-04-10 02:16:29+00:00     Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name miniwdl was given, but was not able to be found.
2020-04-10 02:16:29+00:00     error in setup command: Error parsing /tmp/pip-l3lg3stq-build/setup.cfg: Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name miniwdl was given, but was not able to be found.

I wish pbr was compatible with source tarballs.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1725

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.04%) to 96.659%

Files with Coverage Reduction New Missed Lines %
WDL/runtime/download.py 1 98.59%
WDL/runtime/workflow.py 1 97.02%
Totals Coverage Status
Change from base Build 1717: -0.04%
Covered Lines: 5439
Relevant Lines: 5627

💛 - Coveralls

@kislyuk
Copy link
Contributor Author

kislyuk commented Apr 10, 2020

It turns out hostname doesn't work properly on Batch/ECS anyway, since it gets set to this format: ip-172-31-20-61.us-west-2.compute.internal. I will use os.environ["AWS_BATCH_JOB_ID"] but that is obviously not generalizable.

@kislyuk kislyuk closed this Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants