Skip to content

awsbsub ignores -w option when string command is provided #1059

Open
@mattwelborn

Description

@mattwelborn

Environment:

  • AWS ParallelCluster / CfnCluster version: aws-parallelcluster-2.3.1
  • OS: alinux
  • Scheduler: awsbatch
  • Master instance type: t2.nano
  • Compute instance type: determined by awsbatch

Bug description and how to reproduce:
The -w flag is ignored by awsbsub when a string command is provided as an argument. Looking at cli/awsbatch/awsbsub.py, it can be seen that args.working_dir is only used in _compose_bash_command which is only called if args.command_file or not sys.stdin.isatty() or args.env.

Incorrect behavior example:
Input: awsbsub -w /home/ec2-user pwd
Output:

2019-05-19T21:35:15+00:00: Job id: d519dc44-72e9-45d0-aae9-6eb5e502fafa
2019-05-19T21:35:15+00:00: Initializing the environment...
2019-05-19T21:35:15+00:00: Starting ssh agents...
2019-05-19T21:35:15+00:00: Agent pid 7
2019-05-19T21:35:15+00:00: Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
2019-05-19T21:35:16+00:00: Mounting /home...
2019-05-19T21:35:16+00:00: Mounting shared file system...
2019-05-19T21:35:16+00:00: Starting the job...
2019-05-19T21:35:16+00:00: /

Correct behavior example:
Input: echo pwd | awsbsub -w /home/ec2-user
Output:

2019-05-19T21:35:18+00:00: Job id: 033c9be8-6964-4a67-86bd-eea069c55ba1
2019-05-19T21:35:18+00:00: Initializing the environment...
2019-05-19T21:35:18+00:00: Starting ssh agents...
2019-05-19T21:35:18+00:00: Agent pid 9
2019-05-19T21:35:18+00:00: Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
2019-05-19T21:35:19+00:00: Mounting /home...
2019-05-19T21:35:19+00:00: Mounting shared file system...
2019-05-19T21:35:19+00:00: Starting the job...
2019-05-19T21:35:20+00:00: /home/ec2-user

Metadata

Metadata

Assignees

No one assigned

    Labels

    awsbatchAWS Batch related issue or FEbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions