Create
$ conda create -p /path/to/your/environment --python=3.6
| from tqdm import tqdm | |
| from time import sleep | |
| n_steps = 100 | |
| msg = {'loss': 1, 'acc': 0.0} | |
| with tqdm(total=n_steps, postfix=msg, ascii=True) as pbar: | |
| for i in range(n_steps): | |
| sleep(1) | |
| msg['loss'] -= 0.01 | |
| msg['acc'] += 0.01 |
Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services,
no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.
Let's create a example foo service that when started creates a file, and when stopped it deletes it.
Create executable file /opt/foo/setup-foo.sh:
| #include <sys/socket.h> | |
| #include <sys/types.h> | |
| #include <netinet/in.h> | |
| #include <arpa/inet.h> | |
| #include <netdb.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| #include <iostream> | |
| #include <stdarg.h> | |
| #include <stdio.h> |