-
Notifications
You must be signed in to change notification settings - Fork 23
Conversation
This adds the `--port` flag to the `beaker session create` command.
cmd.Flags().Float64Var(&cpus, "cpus", 0, "Minimum CPU cores to reserve, e.g. 7.5") | ||
cmd.Flags().IntVar(&gpus, "gpus", 0, "Minimum number of GPUs to reserve") | ||
cmd.Flags().StringVar(&memory, "memory", "", "Minimum memory to reserve, e.g. 6.5GiB") | ||
cmd.Flags().StringVar(&sharedMemory, "shared-memory", "", "Shared memory (size of /dev/shm), e.g. 1GiB") | ||
cmd.Flags().StringSliceVar( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the roadmap for adding preemptible to beaker flags :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is really cool, Sam!
@@ -178,6 +185,17 @@ To pass flags, use "--" e.g. "create -- ls -l"`, | |||
}) | |||
} | |||
|
|||
var tcpPorts []api.TCPPort | |||
for _, p := range ports { | |||
pp, err := strconv.ParseInt(p, 10, 32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, I love that go
has 3 parameters for ParseInt
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, setting the bit size was surprising. Particularly when the type that's returned is int
.
It'd be nice if it were a separate function, say, strconv.ParseInt32()
. That way the returned type could be int32
and I wouldn't have to cast/convert things in code. But of course blows out the stdlib a bit. It's tricky!
/shrug
This adds the
--port
flag to thebeaker session create
command.
This codebase doesn't have any tests. So I tested manually. I started
a local executor, then build a local
beaker
CLI and started a sessionlike so:
This worked! The
docker ps
command shows the container, with a random portbound to container port
8888
:I tested invalid ports (overflow, 0, etc). Everything seemed to work.
https://github.com/allenai/beaker-service/issues/2009