Skip to content

Commit 79eeed8

Browse files
Merge pull request #128 from lukemartinlogan/main
add passwordless ssh and long running
2 parents 6992e2f + 7f5fe35 commit 79eeed8

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Long-Running Tasks
2+
3+
Long-running (i.e., periodic) tasks are periodically scheduled on an interval.
4+
This can be used for things like monitoring and batching requests.
5+
6+
Below is an example of PollStatsTask, which gets periodically scheduled.
7+
```cpp
8+
struct PollStatsTask : public Task, TaskFlags<TF_SRL_SYM> {
9+
OUT BdevStats stats_;
10+
11+
/** SHM default constructor */
12+
HSHM_INLINE_CROSS_FUN
13+
explicit PollStatsTask(const hipc::CtxAllocator<CHI_ALLOC_T> &alloc)
14+
: Task(alloc) {}
15+
16+
/** Emplace constructor */
17+
HSHM_INLINE_CROSS_FUN
18+
explicit PollStatsTask(const hipc::CtxAllocator<CHI_ALLOC_T> &alloc,
19+
const TaskNode &task_node, const PoolId &pool_id,
20+
const DomainQuery &dom_query, u32 period_ms)
21+
: Task(alloc) {
22+
// Initialize task
23+
task_node_ = task_node;
24+
pool_ = pool_id;
25+
method_ = Method::kPollStats;
26+
if (period_ms) {
27+
task_flags_.SetBits(TASK_PERIODIC);
28+
prio_ = TaskPrioOpt::kHighLatency;
29+
} else {
30+
task_flags_.SetBits(0);
31+
prio_ = TaskPrioOpt::kLowLatency;
32+
}
33+
dom_query_ = dom_query;
34+
35+
SetPeriodMs(period_ms);
36+
HILOG(kInfo, "PollStatsTask: period_ms={}", period_ms);
37+
}
38+
};
39+
```
40+
41+
There are two things that make a task scheduled periodically.
42+
1. ``task_flags_.SetBits(TASK_PERIODIC)``: This will mark the task as periodically scheduled. There is now a
43+
``TASK_LONG_RUNNING`` flag which is an alias to ``TASK_PERIODIC``.
44+
1. ``SetPeriodMs(period_ms)``: This sets the minimum amount of time to elapse before rescheduling this task.
45+
46+
There are several different timing functions:
47+
1. ``SetPeriodNs``
48+
1. ``SetPeriodUs``
49+
1. ``SetPeriodMs``
50+
1. ``SetPeriodSec``
51+
1. ``SetPeriodMin``

docs/81-jarvis/02-jarvis-cd/01-index.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,29 @@ pipeline. Jarvis does not automatically detect changes to this file.
149149
jarvis ppl update
150150
```
151151

152+
## Set Up Passwordless SSH
153+
154+
When working with more than one node, passwordless SSH is nice-to-have. While most
155+
HPC machines are already equipped with this, some types such as Chameleon Cloud,
156+
Cloudlab, and other bare-metal deployments do not. Jarvis comes with some tools to help
157+
bootstrap this. Here is an example for Chameleon.
158+
159+
Let's say that your chameleon node is 129.127.0.124. First, we need to copy the SSH key there.
160+
```bash
161+
jarvis ssh copy ~/.ssh/id_ed25519 129.127.0.124
162+
```
163+
164+
Next, you have to copy that key to all nodes. First, construct a hostfile containing all nodes
165+
you have allocated
166+
```bash
167+
jarvis hostfile set ~/hostfile.txt
168+
```
169+
170+
Lastly, distribute the key.
171+
```bash
172+
jarvis ssh distribute ~/.ssh/id_ed25519
173+
```
174+
152175
## Building a Resource Graph
153176

154177
NOTE: This step only needs to be run if you did ``jarvis bootstrap from local`` or ``jarvis init``.

0 commit comments

Comments
 (0)