summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/copy_rename_100_files
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2019-02-24 21:05:27 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2019-02-24 21:05:27 +0100
commit8081a5520a441b43a8a7a73f3a90c7aacfaa8e10 (patch)
treec7f49bd33ed19d53afc0ee9df8b2c82c200c5910 /kpov_judge/tasks/copy_rename_100_files
parent9963b74f777edf985540eac71b1ca095f88b8bca (diff)
Move everything one level up
Diffstat (limited to 'kpov_judge/tasks/copy_rename_100_files')
-rw-r--r--kpov_judge/tasks/copy_rename_100_files/task.py120
1 files changed, 0 insertions, 120 deletions
diff --git a/kpov_judge/tasks/copy_rename_100_files/task.py b/kpov_judge/tasks/copy_rename_100_files/task.py
deleted file mode 100644
index 9dcf69a..0000000
--- a/kpov_judge/tasks/copy_rename_100_files/task.py
+++ /dev/null
@@ -1,120 +0,0 @@
-# TODO:
-# - check if everything is filled in (computers, params, preparation)
-# - improve scoring
-# - test
-# - switch to a real SSH/SFTP client to properly handle filenames
-
-instructions = {
- 'si':"""
-<pre>Ustvari dva navidezna računalnika. Za prvega uporabi sliko diska simpleArbiterDhcp. Na drugem računalniku
-ustvari uporabnika test z geslom test.
-Na sliki diska simpleArbiterDhcp najdeš imenik s 100 datotekami. Prekopiraj vse datoteke na drugi računalnik v domači imenik uporabnika test.
-Spremeni vsebino datotek tako, da vse male črke spremeniš v velike. Poskrbi, da se bo s prvega računalnika (simpleArbiterDhcp) mogoče prek
-ssh prijaviti na drugi računalnik in prebrati predelane datoteke.</pre>
-""",
- 'en': '''
-<pre>Create two virtual machines. For the first, use the `simpleArbiterDhcp' image.
-On the second machine, create a user `test' with the password `test'.
-The `simpleArbiterDhcp' disk image contains a folder with 100 files. Copy all
-of these files to the other computer into the home folder of theuser `test'.
-Modify the content of these files by converting all lowercase letters into
-uppercase. Make sure that the first machine (`simpleArbiterDhcp') can use ssh
-to access the second machine and read the processed files.</pre>
-''',
-}
-
-computers = {
- 'SimpleArbiter': {
- 'disks': [
- {
- 'name': 'simpleArbiterDhcp',
- },
- ],
- 'network_interfaces': [
- {
- 'network': 'net1',
- },
- ],
- 'flavor': 'm1.tiny',
- 'config_drive': False,
- }
-}
-
-networks = {
- 'net1': {
- 'public': True,
- },
-}
-
-params_meta = {
- 'folder': {
- 'descriptions': {
- 'si': 'Mapa, ki vsebuje 100 datotek',
- 'en': 'A folder with 100 files',
- },
- 'w': False,
- 'public': True,
- 'type': 'dirname',
- 'generated': False,
- },
- 'host': {
- 'descriptions': {
- 'si': 'Naslov racunalnika, na katerega kopiramo datoteke',
- 'en': 'The address of the computer to which the files are copied',
- },
- 'w': True,
- 'public': True,
- 'type': 'IP',
- 'generated': False,
- },
-}
-
-def task(host, folder):
- return kpov_util.ssh_test(host, 'test', 'test', (
- ('files', 'ls -1'), # XXX: file may have newlines
- ('contents', 'cat *'), # XXX: may include other files in $HOME
- ))
-
-def gen_params(user_id, params_meta):
- pass
-
-def task_check(results, params):
- import os
-
- score = 0
- hints = []
- if results['ssh'] is not True:
- hints += ['ssh failed: ' + results['ssh']]
-
- matched = 0
- files = os.listdir(params['folder'])
- for fn in files:
- if fn in results['files'].splitlines():
- matched += 1
- if matched > 0:
- score = 1
- else:
- hints += ["no files"]
- if matched > len(files)/2:
- score += 2
- else:
- hints += ["less than half the files"]
- if (matched == len(files)):
- score += 3
- else:
- hints += ["wrong number of files"]
- rl = results['contents'].splitlines()
- rl.sort()
- tl = []
- for fn in files:
- with open(os.path.join(params['folder'], fn)) as f:
- tl += f.read().upper().splitlines()
- tl.sort()
- if rl == tl:
- score += 4
- else:
- hints += ["wrong files"]
- return score, hints
-
-def prepare_disks(templates, task_params, global_params):
- pass