Compare commits
14 Commits
876558ae41
...
bd9f9bc956
Author | SHA1 | Date | |
---|---|---|---|
![]() |
bd9f9bc956 | ||
![]() |
f9f0da665f | ||
![]() |
2fd51d50eb | ||
![]() |
287a95e479 | ||
![]() |
5c6fb3911e | ||
![]() |
27cf99c23a | ||
![]() |
ef0ac61db5 | ||
![]() |
e5f56ff162 | ||
![]() |
43704f156b | ||
![]() |
1aa6a152f3 | ||
![]() |
e5ebfb287d | ||
![]() |
b458dcec4a | ||
![]() |
308a92bc23 | ||
![]() |
93efdc9032 |
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
# Terminology
|
# Terminology
|
||||||
## Cluster Terms
|
## Cluster Terms
|
||||||
|
|
||||||
@ -12,7 +13,70 @@
|
|||||||
| Phrase | Definition |
|
| Phrase | Definition |
|
||||||
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| task | The smallest unit of work in Nomad. Tasks are executed by task drivers like `docker` or `exec`, which allows Nomad to be flexible in the types of tasks it supports. Tasks specify their required task driver, configuration for the driver, constraints, and resources required. |
|
| task | The smallest unit of work in Nomad. Tasks are executed by task drivers like `docker` or `exec`, which allows Nomad to be flexible in the types of tasks it supports. Tasks specify their required task driver, configuration for the driver, constraints, and resources required. |
|
||||||
|
| task driver | Task drivers are used by nomad clients to execute a task and provide resource isolation. |
|
||||||
| group | A series of tasks that run on the same Nomad client. |
|
| group | A series of tasks that run on the same Nomad client. |
|
||||||
| job | The core unit of *control* for Nomad and defines the application and its configuration. It can contain one or many tasks |
|
| job | The core unit of *control* for Nomad and defines the application and its configuration. It can contain one or many tasks |
|
||||||
| job_specification/jobspec | A job specification, also known as a jobspec. |
|
| job_specification/jobspec | A job specification, also known as a jobspec defines the schema for nomad jobs. This describes the type of the job, the tasks and resources necessary for the job to run, job information like which clients it can run on, or more. |
|
||||||
| allocation | An allocation is a mapping between a task group in a job and a client node. When a job is run, Nomad will chose a client capable of running it and allocates resources on the machine for the ask(s) in the task group defined for the job. |
|
| allocation | An allocation is a mapping between a task group in a job and a client node. When a job is run, Nomad will chose a client capable of running it and allocates resources on the machine for the ask(s) in the task group defined for the job. |
|
||||||
|
| workload artifact | The runnable blob to be scheduled on a task driver. Examples include docker images, raw binaries, java applications, and VMs using QEMU. |
|
||||||
|
|
||||||
|
# Typical Workflow
|
||||||
|
Running a task is generally done by:
|
||||||
|
1. *Define a job specification for your task(s):* it'll contain info like where the workload artifact is located, ports used by the service, the number of instances desired, and more.
|
||||||
|
2. *Deploying the job*: The jobspec is submitted to Nomad and it schedules an allocation for the job on one or more clients.
|
||||||
|
3. Updating and redploying the job.
|
||||||
|
|
||||||
|
# Deployment
|
||||||
|
## Installing the CLI
|
||||||
|
https://developer.hashicorp.com/nomad/tutorials/get-started/gs-install#install-the-nomad-cli
|
||||||
|
|
||||||
|
## Creating a single node cluster
|
||||||
|
<https://stackoverflow.com/questions/56112422/nomad-configuration-for-single-node-to-act-as-production-server-and-client>
|
||||||
|
1. Install the `nomad` binary.
|
||||||
|
2. Create a config file with in `/etc/nomad.d` named `config.hcl`:
|
||||||
|
```hcl
|
||||||
|
# https://developer.hashicorp.com/nomad/docs/configuration
|
||||||
|
# The client block configures the Nomad agent to accept jobs as assigned
|
||||||
|
# by the server.
|
||||||
|
# https://developer.hashicorp.com/nomad/docs/configuration/client
|
||||||
|
client {
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
|
# https://developer.hashicorp.com/nomad/docs/configuration/server
|
||||||
|
server {
|
||||||
|
enabled = true
|
||||||
|
# The number of server nodes to wait for before bootstrapping.
|
||||||
|
bootstrap_expect = 1
|
||||||
|
}
|
||||||
|
# The local directory where agent state is stored.
|
||||||
|
data_dir = "/opt/nomad"
|
||||||
|
name = "YOUR_NOMAD_NAME_HERE"
|
||||||
|
```
|
||||||
|
3. Create a Linux service `nomad.service` inside `/etc/systemd/system`:
|
||||||
|
```systemd
|
||||||
|
[Unit]
|
||||||
|
Description=Nomad
|
||||||
|
Documentation=https://nomadproject.io/docs/
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
ExecStart=/usr/local/bin/nomad agent -config /etc/nomad.d
|
||||||
|
KillMode=process
|
||||||
|
KillSignal=SIGINT
|
||||||
|
LimitNOFILE=infinity
|
||||||
|
LimitNPROC=infinity
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=2
|
||||||
|
StartLimitBurst=3
|
||||||
|
TasksMax=infinity
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
4. Start the service with `sudo systemctl enable nomad && sudo systemctl start nomad`.
|
||||||
|
# Resources
|
||||||
|
- <https://developer.hashicorp.com/nomad/tutorials/get-started/gs-overview>
|
||||||
|
- <https://developer.hashicorp.com/nomad/docs/drivers>
|
||||||
|
- https://developer.hashicorp.com/nomad/docs/configuration
|
@ -107,6 +107,26 @@ $A$, $B$, $C$, and $D$ will have similar meanings to the cosecant function as th
|
|||||||
- The vertical asymptotes of secant occur at $x = \frac{C}{B} + \frac{\pi}{2} + \frac{\pi}{2} + \frac{\pi}{|B|}k$, where $k$ is an integer.
|
- The vertical asymptotes of secant occur at $x = \frac{C}{B} + \frac{\pi}{2} + \frac{\pi}{2} + \frac{\pi}{|B|}k$, where $k$ is an integer.
|
||||||
- The vertical asymptotes of cosecant occur at $x = \frac{C}{B} + \frac{\pi}{|B|}k$, where $k$ is an integer.
|
- The vertical asymptotes of cosecant occur at $x = \frac{C}{B} + \frac{\pi}{|B|}k$, where $k$ is an integer.
|
||||||
- The vertical shift is $D$.
|
- The vertical shift is $D$.
|
||||||
|
# Inverse Functions
|
||||||
|
For any one to one function $f(x) = y$, a function $f^{-1}(y) = x)$. A function is considered one-to-one if every input only has one output, and every output can only be created from a single input.
|
||||||
|
|
||||||
|
The inverse of a trig function is denoted as $sin^{-1}$, or $arcsin$ respectively.
|
||||||
|
|
||||||
|
The inverse of a trig function is **not** the same as the reciprocal of a trig function, $\frac{1}{sin}$ is not the same as $sin^{-1}$.
|
||||||
|
|
||||||
|
- The *domain* of $f$ is the *range* of $f^{-1}$.
|
||||||
|
- The *range* of $f$ is the *domain* of $f^{-1}$.
|
||||||
|
|
||||||
|
| Trig functions | Inverse trig functions |
|
||||||
|
| ----------------------------------- | ------------------------------------ |
|
||||||
|
| Domain: Angle measures | Domain: Ratio of sides of a triangle |
|
||||||
|
| Range: Ratio of sides of a triangle | Range: Angle Measure |
|
||||||
|
- To find the inverse of sin, you need to restrict the domain to $[-\frac{\pi}{2}, \frac{\pi}{2}]$
|
||||||
|
- To find the inverse of cos, you need to restrict the domain to $[0, \pi]$
|
||||||
|
- To find the inverse of tangent, you need to restrict the domain to $(-\frac{\pi}{2}, \frac{\pi}{2})$.
|
||||||
|
|
||||||
|
The graphs of an inverse function can be found by taking the graph of $f$, and flipping it over the line $y=x$.
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
> Given $-2\tan(\pi*x + \pi) - 1$
|
> Given $-2\tan(\pi*x + \pi) - 1$
|
||||||
|
|
||||||
@ -127,3 +147,8 @@ Vertical shift: $1$
|
|||||||
| Period | $\frac{\pi}{\|\pi\|} = 1$ |
|
| Period | $\frac{\pi}{\|\pi\|} = 1$ |
|
||||||
| Phase shift | $\frac{-\pi}{\pi} = -1$ |
|
| Phase shift | $\frac{-\pi}{\pi} = -1$ |
|
||||||
| Vertical shift | $-1$ |
|
| Vertical shift | $-1$ |
|
||||||
|
> Evaluate $\arccos{\frac{1}{2}}$ using the unit circle.
|
||||||
|
|
||||||
|
Taking the inverse of the above function, we get this. Because the domain of $cos$ ranges from $0$ to $\pi$ inclusive, the answer is going to be in quadrant 1 or quadrant 2.
|
||||||
|
$$ cos(a) = \frac{1}{2} $$
|
||||||
|
When $x$ is equal to one half, the angle is equal to $\frac{\pi}{3}$.
|
@ -38,6 +38,16 @@ In C, a `char` denotes a single byte of arbitrary encoding.
|
|||||||
## Variables
|
## Variables
|
||||||
A variable must be declared before it is assigned.
|
A variable must be declared before it is assigned.
|
||||||
|
|
||||||
|
## Arrays
|
||||||
|
### Finding the size of an array
|
||||||
|
```c
|
||||||
|
int arr[10];
|
||||||
|
// The size of an array can be found by
|
||||||
|
// determining the number of bytes allocated total and dividing that by the size of each element in the array.
|
||||||
|
int arr_size = sizeof(arr) / sizeof(arr[0]);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
# Formatting specifiers
|
# Formatting specifiers
|
||||||
# Standard library
|
# Standard library
|
||||||
@ -98,4 +108,9 @@ When asked to read a float, `scanf` searches for one of:
|
|||||||
`%e`, `%f`, and `%g` all follow the same rules for recognizing floating point numbers.
|
`%e`, `%f`, and `%g` all follow the same rules for recognizing floating point numbers.
|
||||||
|
|
||||||
If an ordinary character is included in the pattern matching string, it will be matched then discarded before proceeding to the next character.
|
If an ordinary character is included in the pattern matching string, it will be matched then discarded before proceeding to the next character.
|
||||||
|
## `rand`
|
||||||
|
```c
|
||||||
|
// `srand` creates a seed to use for rng
|
||||||
|
seed = srand(time(NULL));
|
||||||
|
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user