Skip to content

Commit ce09fb6

Browse files
fox some tasks
1 parent abc556e commit ce09fb6

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "netunicorn-library"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
authors = [
55
{name = "Roman Beltiukov", email = "[email protected]"},
66
]

tasks/measurements/ping.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from dataclasses import dataclass
33
from typing import List
44

5+
from netunicorn.base.architecture import Architecture
56
from netunicorn.base.nodes import Node
67
from netunicorn.base.task import Failure, Task, TaskDispatcher
78

@@ -35,10 +36,10 @@ def __init__(self, address: str, count: int = 1, *args, **kwargs):
3536
super().__init__(*args, **kwargs)
3637

3738
def dispatch(self, node: Node) -> Task:
38-
if node.properties.get("os_family", "").lower() == "linux":
39+
if node.architecture in {Architecture.LINUX_AMD64, Architecture.LINUX_ARM64}:
3940
return PingLinuxImplementation(self.address, self.count)
4041
raise NotImplementedError(
41-
f'Ping is not implemented for {node.properties.get("os_family", "")}'
42+
f'Ping is not implemented for architecture: {node.architecture}'
4243
)
4344

4445

tasks/qoe_youtube/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(self, start_task_name: str, *args, **kwargs):
8181
super().__init__(*args, **kwargs)
8282

8383
def dispatch(self, node: Node) -> Task:
84-
if node.properties.get("os_family", "").lower() == "linux":
84+
if node.architecture in {Architecture.LINUX_AMD64, Architecture.LINUX_ARM64}:
8585
return StopQoECollectionServerLinuxImplementation(start_task_name=self.start_task_name, name=self.name)
8686

8787
raise NotImplementedError(
@@ -137,7 +137,7 @@ def dispatch(self, node: Node) -> Task:
137137
)
138138

139139
raise NotImplementedError(
140-
f'WatchYouTubeVideo is not implemented for {node.properties.get("os_family", "")}'
140+
f'WatchYouTubeVideo is not implemented for architecture: {node.architecture}'
141141
)
142142

143143

tasks/video_watchers/twitch_watcher.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import Optional
99

1010
from netunicorn.base import Result, Success, Task, TaskDispatcher
11+
from netunicorn.base.architecture import Architecture
1112
from netunicorn.base.nodes import Node
1213

1314
from selenium import webdriver
@@ -48,11 +49,11 @@ def __init__(self, video_url: str, duration: Optional[int] = None, *args, **kwar
4849
super().__init__(*args, **kwargs)
4950

5051
def dispatch(self, node: Node) -> Task:
51-
if node.properties.get("os_family", "").lower() == "linux":
52+
if node.architecture in {Architecture.LINUX_AMD64, Architecture.LINUX_ARM64}:
5253
return WatchTwitchStreamLinuxImplementation(self.video_url, self.duration, name=self.name)
5354

5455
raise NotImplementedError(
55-
f'WatchYouTubeVideo is not implemented for {node.properties.get("os_family", "")}'
56+
f'WatchTwitchVideo is not implemented for architecture: {node.architecture}'
5657
)
5758

5859

tasks/video_watchers/vimeo_watcher.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import Optional
99

1010
from netunicorn.base import Result, Failure, Success, Task, TaskDispatcher
11+
from netunicorn.base.architecture import Architecture
1112
from netunicorn.base.nodes import Node
1213

1314
from selenium import webdriver
@@ -78,11 +79,11 @@ def __init__(self, video_url: str, duration: Optional[int] = None, *args, **kwar
7879
super().__init__(*args, **kwargs)
7980

8081
def dispatch(self, node: Node) -> Task:
81-
if node.properties.get("os_family", "").lower() == "linux":
82+
if node.architecture in {Architecture.LINUX_AMD64, Architecture.LINUX_ARM64}:
8283
return WatchVimeoVideoLinuxImplementation(self.video_url, self.duration, name=self.name)
8384

8485
raise NotImplementedError(
85-
f'WatchYouTubeVideo is not implemented for {node.properties.get("os_family", "")}'
86+
f'WatchVimeoVideo is not implemented for architecture: {node.architecture}'
8687
)
8788

8889

tasks/video_watchers/youtube_watcher.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from enum import IntEnum
1010

1111
from netunicorn.base import Result, Failure, Success, Task, TaskDispatcher
12+
from netunicorn.base.architecture import Architecture
1213
from netunicorn.base.nodes import Node
1314

1415
from selenium import webdriver
@@ -101,11 +102,11 @@ def __init__(self, video_url: str, duration: Optional[int] = None, *args, **kwar
101102
super().__init__(*args, **kwargs)
102103

103104
def dispatch(self, node: Node) -> Task:
104-
if node.properties.get("os_family", "").lower() == "linux":
105+
if node.architecture in {Architecture.LINUX_AMD64, Architecture.LINUX_ARM64}:
105106
return WatchYouTubeVideoLinuxImplementation(self.video_url, self.duration, name=self.name)
106107

107108
raise NotImplementedError(
108-
f'WatchYouTubeVideo is not implemented for {node.properties.get("os_family", "")}'
109+
f'WatchYouTubeVideo is not implemented for architecture: {node.architecture}'
109110
)
110111

111112

0 commit comments

Comments
 (0)