• 沒有找到結果。

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

library name, the control center will prepare the task name and the permitted queues for committing the result. With the task name and library, computing node could perform dynamic loading technique and invoke an instance for further computing. If all the tasks are done at some point, the control center would ask computing node to go back to the previous state for the other jobs. The state would go to Data Required if the client invoke the instance successfully.

6.2.3 Data Required

In this stage, computing node holds an instance as a computing unit and asks control center for data to process. The computing node would send a request with task informa-tion and the previous outcome if it exists. Once the control center gets the request from a computing node, it starts to prepare a data list for computing node to process. The amount of elements contained in the data list would be determined by task type in the task information. By definition, map, flatMap and foreach requires at least one element but reduce requires at least two. Meanwhile, if the request contains the previous outcome, the control center would push the outcome into the queue that specified by the task. The state will not change till the target queue running out of the data; otherwise the state would back to Task Required for invoking another instance of the task.

6.2.4 Stop

As the only accepting state, only a few conditions happens could arrive here. One is running out of the jobs to do, the other is the occurrence of unexpected error such like network error or device runs out of memory.

6.3 Permissions

For achieving the goal of porting tasks dynamically to clients, Gnafuy app requires lots of permission [32] from users. Gnafuy app requires permission of reading/writing file to SD card since it would create a temporary jar file in Library Required state for performing

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

dynamic loading via reflection mechanism. Also we have to ask users for permission of accessing network state and permission of accessing power connected so we could detect that the device have Wi-Fi connected and the current charge state if users prefer to contribute their computing power when both Wi-Fi connected and battery is charging.

In order to offer more information for developers, we also give permissions to access approximate/precise location and the string uniquely identifies the device (IMEI on GSM, MEID for CDMA). Table reveals the permissions that we acquire from users who install our app. By giving the permissions listed above, Ganfuy app is able to work correctly

Table 2: Android permissions that Gnafuy enabled

Android permissions Description

WRITE_EXTERNAL_STORAGE Allows an application to write to external storage.

READ_EXTERNAL_STORAGE Allows an application to read from external storage.

READ_PHONE_STATE Allows read only access to phone state.

ACCESS_NETWORK_STATE Allows applications to access information about networks.

BATTERY_STATS Allows an application to collect battery statistics.

INTERNET Allows applications to open network sockets.

ACCESS_FINE_LOCATION Allows an app to access precise location.

ACCESS_COARSE_LOCATION Allows an app to access approximate location.

and shares computing power only when Wi-Fi connected and charging is charging. Also our developers would able to retrieve information from smartphones such as battery state, network state and precise location of computing nodes.

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

7 Experiment

7.1 Citation network

In this section we design an application to build a citation network of academic publishing.

As the link of an initial paper from google scholar is entered, our application could find papers that had once cited the premier one by inspecting the Cited by hyperlinks on the google scholar page. Then, when the next round initiate, papers that had cited the original paper would become the next starting point thus performing the algorithm iteratively. Since the input is a paper and the output is a list of cited papers, the proper programming model of our fetching algorithm is described as flatMap, which takes one element of type K and produces a list of type T For the algorithm convergence, we only adopt the first n papers from the original paper. The value n is determined by the formula n = qc/r where c stands for the amount of cited by papers and r stands the r round of current iteration. The algorithm stops to adopting papers on the condition when r is greater than n.

The next thing is to configure the control flow by Job Builder then activate build() method to send job with algorithm 4 to control center. Once control center received the job, it starts to federate smartphones to achieve this job. By far it’s a simple application for experienced developers to implement as described below by mocking requests from the web browser to deceive the server. However, the response would redirect to the reCAPTCHA [33] page after some iterations which stops our robot fetching papers until our robot solve the problem. The problem would vary over time and the problem could be "Select all squares with street signs" or "Select all rivers and mountains". It’s hard for us to figure out a general solution to answer the question like the example in figure 3 challenged by reCAPTCHA since it requires the knowledge of natural language processing to understand the question and image recognition to answer the question. Google offers reCAPTCHA as the protector of websites from spam and abuse with the slogan "Tough on bots, Easy on humans" which indeed keeps our application out.

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

Figure 3: reCAPTCHA example

Instead of figuring out a general solution for the puzzles, a more reasonable approach is to redesign our application by involving an user interface for retrieving user’s suggestion on facing the reCAPTCHA problem. Though Ganfuy gains computation power by launching our app on mobile devices, the app itself does not display anything on the screen. Also we didn’t provide API for developer to compose the user interface on the screen. It’s seems not possible to achieve the goal of taking user input in this framework. Fortunately, Selenium, a well known utility for web browser automation, provides the capability to automates browsers and gives a slim chance of survival to solve the problem. By importing Selenium into the previous algorithm, we could manipulate the browsers on the mobile device as the user interface. Once our fetching robot get stuck, the algorithm could stop to wait for user’s rescue to solve the puzzle. The function waitForUserToSolveThePuzzle() in algorithm 4 should be called on every time when we manipulate the browser.

In this case, the result in algorithm 4 will send to the original queue where we get the link of an initial paper from and the initial link is updated with its descendants then send

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

Algorithm 4 Citation Network FlatMapper Input: Link of an initial paper

Output: Papers that had once cited the initial paper

1: result ← φ

2: bound ←qc/l

3: adoption ← 0

4: if bound > l then

5: browser ← openBrowser(initialLink)

6: while adoption < bound do

7: waitF orU serT oSolveT heP uzzle()

8: result ← result ∪ f etchContent()

9: adoption ← adoption + 1

10: browser.goT oN extP age()

11: end while

12: end if

13: initialLink.setChildren(result)

14: sendT oQueue(initialLink, processed)

15: return result

to the processed queue. The processed queue contains all the information we need for building a citation network since we have all papers with its descendants. By sorting out

Figure 4: Citation Network

the outcome and utilizing some visualization tool, we build a graph as shown in figure 4 which provide a concise view for scholars to check the lineage of the paper they interest.

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

相關文件